[英]Unable to connect to remote hbase from java program
嗨,我试图从我的java程序连接远程机器中的hbase。 但我得到连接拒绝错误。 在查看错误时,我认为它正在尝试连接到我的localhost而不是远程计算机。
我的配置是 -
HBaseConfiguration conf = new HBaseConfiguration();
conf.set("hbase.master", "10.219.47.22:60010");
conf.set("hbase.zookeeper.quorum.", "10.219.47.22:60010");
conf.set("hbase.zookeeper.property.clientPort", "2181");
我收到以下错误
13/11/15 17:35:08 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(Unknown Source)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068)
13/11/15 17:35:08 INFO zookeeper.ClientCnxn: Opening socket connection to server 127.0.0.1/127.0.0.1:2180. Will not attempt to authenticate using SASL (unknown error)
13/11/15 17:35:08 WARN zookeeper.RecoverableZooKeeper: Possibly transient ZooKeeper exception: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/master
13/11/15 17:35:08 INFO util.RetryCounter: The 1 times to retry after sleeping 2000 ms
此外,在远程计算机上运行lsof以检查我的端口2181是否已打开。 我得到以下结果 -
java 18854 root 266u IPv6 6199707 0t0 TCP 127.0.0.1:47000->127.0.0.1:2181 (CLOSE_WAIT)
你的zookeeper quorum ip adderess 10.219.47.22:60010
还指定一个端口(60010)删除你也有一个不必要的.
法定人数之后
conf.set("hbase.zookeeper.quorum", "10.219.47.22");
conf.set("hbase.zookeeper.property.clientPort", "2181");
60010端口仅适用于web ui而非连接。 检查此代码段是否可以为您提供帮助:
Configuration hbaseConfiguration = HBaseConfiguration.create();
hbaseConfiguration.addResource(new Path("hbase-site.xml");
并在hbase-site.xml文件中添加主节点上hbase安装文件夹的conf文件夹中的属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.