admin管理员组

文章数量:1608629

HBase已经常启动,在shell里也可以正常操作,但在eclipse中java操作HBase时,报如下错误: 15/07/27 15:18:21 INFO zookeeper.ClientCnxn: Opening socket connection to server 127.0.0.1/127.0.0.1:2181. Will not attempt to authenticate using SASL (无法定位登录配置) 15/07/27 15:18:22 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.ConnectException: Connection refused: no further information  at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)  at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:599)  at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350)  at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068) 15/07/27 15:18:22 INFO zookeeper.ClientCnxn: Opening socket connection to server 0:0:0:0:0:0:0:1/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (无法定位登录配置) 15/07/27 15:18:22 ERROR zookeeper.ClientCnxnSocketNIO: Unable to open socket to 0:0:0:0:0:0:0:1/0:0:0:0:0:0:0:1:2181 15/07/27 15:18:22 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.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:532)  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) 15/07/27 15:18:22 WARN zookeeper.RecoverableZooKeeper: Possibly transient ZooKeeper exception: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/hbaseid


解决方法:

在代码中,Configuration里设置hbase.zookeeper.quorum,指定sdw1、sdw2,如果hosts中没有配置sdw1、sdw2解析ip,要直接将sdw1和sdw2换成对应ip,如:

Configuration conf=HBaseConfiguration.create();
conf.set("hbase.zookeeper.quorum", "sdw1,sdw2");
HBaseAdmin admin=new HBaseAdmin(conf);
Configuration conf=HBaseConfiguration.create();
conf.set("hbase.zookeeper.quorum", "192.168.10.201,192.168.10.202");
HBaseAdmin admin=new HBaseAdmin(conf);





本文标签: JavaNETEclipseHbaserefused