eclipse中运行hbase时显示Connection refused: no furthe...

2018-03-30 12:03:25 浏览数 (1)

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)

12/09/03 15:37:15 INFO zookeeper.ClientCnxn: Opening socket connection to server /192.168.0.118:2181

12/09/03 15:37:16 INFO zookeeper.ClientCnxn: EventThread shut down

12/09/03 15:37:16 INFO zookeeper.ZooKeeper: Session: 0x0 closed

Exception in thread "main" org.apache.hadoop.hbase.ZooKeeperConnectionException: HBase is able to connect to ZooKeeper but the connection closes immediately. This could be a sign that the server has too many connections (30 is the default). Consider inspecting your ZK server logs for that error and then make sure you are reusing HBaseConfiguration as often as you can. See HTable's javadoc for more information.

at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.<init>(ZooKeeperWatcher.java:156)

at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getZooKeeperWatcher(HConnectionManager.java:1209)

at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.setupZookeeperTrackers(HConnectionManager.java:511)

at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.<init>(HConnectionManager.java:502)

at org.apache.hadoop.hbase.client.HConnectionManager.getConnection(HConnectionManager.java:172)

at org.apache.hadoop.hbase.client.HBaseAdmin.<init>(HBaseAdmin.java:92)

at com.biencloud.test.first_hbase.main(first_hbase.java:22)

Caused by: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase

at org.apache.zookeeper.KeeperException.create(KeeperException.java:90)

at org.apache.zookeeper.KeeperException.create(KeeperException.java:42)

at org.apache.zookeeper.ZooKeeper.exists(ZooKeeper.java:809)

at org.apache.zookeeper.ZooKeeper.exists(ZooKeeper.java:837)

at org.apache.hadoop.hbase.zookeeper.ZKUtil.createAndFailSilent(ZKUtil.java:931)

at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.<init>(ZooKeeperWatcher.java:134)

... 6 more

这个错误说明eclipse没有连接到zookeeper,在程序中添加zookeeper配置信息即可,具体如下:

Configuration conf=HBaseConfiguration.create();

conf.set("hbase.zookeeper.quorum","192.168.0.118, 192.168.0.186, 192.168.0.182");

conf.set("hbase.zookeeper.property.clientPort","2222");

0 人点赞