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/hbaseidadmin管理员组文章数量:1608627
解决方法:
在代码中,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
版权声明:本文标题:eclipse中连接HBase报java.net.ConnectException: Connection refused: no further information 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dianzi/1728549296a1163230.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论