【发布时间】:2011-09-07 16:38:01
【问题描述】:
我尝试使用客户端程序向 hbase 写入一些数据
HBase @ Hadoop 在来自 Cloudera @ ubuntu 的预配置 VM 中运行。
客户端在托管虚拟机的系统上运行,并在虚拟机中直接运行客户端。
所以现在我想使用虚拟机外的客户端访问虚拟机上的服务器
我正在使用 NAT。 为了能够访问像 HBase Master、HUE..running 这样的服务器,我在虚拟框中配置了端口转发:
因此我可以访问 HBase Master 的概述站点,HUE..
针对我创建的 vm 上的服务器运行客户端 hbase-site.xml 的内容:
<configuration>
<property>
<name>hbase.zookeeper.quorum</name>
<value>localhost</value>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>9997</value>
</property>
<property>
<name>hbase.master</name>
<value>localhost:9999</value>
</property>
</configuration>
所以我希望转发有效:
运行客户端时日志中的错误信息如下:
11/09/07 17:48:00 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=localhost:2181 sessionTimeout=180000 watcher=hconnection
11/09/07 17:48:00 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181
11/09/07 17:48:01 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused: no further information
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:567)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1119)
11/09/07 17:48:01 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181
11/09/07 17:48:01 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.SocketException: Address family not supported by protocol family: connect
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:500)
at org.apache.zookeeper.ClientCnxn$SendThread.startConnect(ClientCnxn.java:1050)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1077)
11/09/07 17:48:03 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181
11/09/07 17:48:04 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused: no further information
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:567)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1119)
11/09/07 17:48:04 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181
11/09/07 17:48:04 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.SocketException: Address family not supported by protocol family: connect
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:500)
at org.apache.zookeeper.ClientCnxn$SendThread.startConnect(ClientCnxn.java:1050)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1077)
11/09/07 17:48:05 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181
正确的连接日志(直接在 vm 上运行客户端时)如下所示:
11/09/07 09:05:29 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=localhost:2181 sessionTimeout=180000 watcher=hconnection
11/09/07 09:05:29 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181
11/09/07 09:05:29 INFO zookeeper.ClientCnxn: Socket connection established to localhost/0:0:0:0:0:0:0:1:2181, initiating session
11/09/07 09:05:29 INFO zookeeper.ClientCnxn: Session establishment complete on server localhost/0:0:0:0:0:0:0:1:2181, sessionid = 0x132449d36df0006, negotiated timeout = 40000
所以我现在只在第一个问题之前的日志行中看到连接 url 不正确,因为端口已正确转发,但 IP 仍然是 localhost 而不是端口转发设置中配置的 10.0.2.15:
Opening socket connection to server localhost/127.0.0.1:2181
我发现的唯一提示是禁用 IPV6 -> 在 host(win7) 和 vm(Ubuntu) 中被禁用 并检查端口 -> 它们被正确转发
有人有想法吗?
【问题讨论】:
-
您的端口对我来说似乎是错误的。您的日志显示 localhost:2181 尽管您配置了 9997。我在我的 Virtual Box 集群上尝试了相同的设置,它工作正常。实际上,您不必设置其他端口,在您的 VM 上保持相同。 => 没有混淆 :) 如果这不是问题,您可以转发端口 22 并通过 putty 打开 SSH 连接并隧道您的端口。
标签: hadoop hbase virtualbox cloudera