zookeeper无法打开socket到localhost / 0:0:0:0:0:0:0:1:2181

时间:2015-01-23 12:13:34

标签: apache hbase nutch apache-zookeeper

我正在使用zookeeper ensemble for hbase。 Zookeeper在3台机器上运行。虽然HBase也处于完全分布式模式。我有Nutch 2.x版本。当我启动nutch来抓取一些数据时,它会在nutch日志文件中给出以下bug。

ERROR zookeeper.ClientCnxnSocketNIO - Unable to open socket to localhost/0:0:0:0:0:0:0:1:2181
2015-01-23 16:34:21,956 WARN  zookeeper.ClientCnxn - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.SocketException: Network is unreachable
        at sun.nio.ch.Net.connect0(Native Method)
        at sun.nio.ch.Net.connect(Net.java:457)
        at sun.nio.ch.Net.connect(Net.java:449)
        at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:647)
        at org.apache.zookeeper.ClientCnxnSocketNIO.registerAndConnect(ClientCnxnSocketNIO.java:266)
        at org.apache.zookeeper.ClientCnxnSocketNIO.connect(ClientCnxnSocketNIO.java:276)
        at org.apache.zookeeper.ClientCnxn$SendThread.startConnect(ClientCnxn.java:958)
        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:993)
2015-01-23 16:34:22,063 WARN  zookeeper.RecoverableZooKeeper - Possibly transient ZooKeeper exception: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/hbaseid

当我在三个zookeepers实例上运行命令时

echo ruok | nc 1.1.1.1 2181 it says imok

它出了什么问题?我的hbase版本是0.94.14,zookeeper版本是3.4.5,solr版本是4.10.3(用于索引),Nutch版本是2.2.3

2 个答案:

答案 0 :(得分:6)

(CentOS)检查/ etc / hosts文件,如果它包含类似

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

将其更改为

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         ip6-localhost ip6-localhost.localdomain localhost6 localhost6.localdomain6

答案 1 :(得分:2)

我不知道zookeeper,但是你发布的两个IP地址没有任何关系:

1.1.1.1是IPV4地址。 0:0:0:0:0:0:0:1是IPV6地址(它是localhost的地址)。 IPV6 localhost地址的简写为::1

因此,如果您期望localhost上的服务器,请确保它也绑定到IPV6,而不仅仅是127.0.0.1(这是localhost的IPV4地址)。我看到过这样的问题,服务器只听了127.0.0.1,或防火墙只允许访问IPV4上的localhost,但不能访问IPV6。

当你要去1.1.1.1时,我不确定你期望得到什么。你在本地使用这个地址吗? AFAIK它是一个公开路由的地址,但我想它会获得很多这种主动提供的流量,它或多或少都无法使用。