Reputation: 2204
Hi I am trying to connect to hbase in a remote machine from my java program. But I am getting connection refused error. On looking at the error I think it is trying to connect to my localhost instead of the remote machine.
My configuration is like-
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");
I am getting the following error
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
Also on running lsof on the remote machine to check if my port 2181 is open. I got the following result-
java 18854 root 266u IPv6 6199707 0t0 TCP 127.0.0.1:47000->127.0.0.1:2181 (CLOSE_WAIT)
Upvotes: 0
Views: 3668
Reputation: 285
The 60010 port is just for web ui not for connection. Check if this code snippet can help you:
Configuration hbaseConfiguration = HBaseConfiguration.create();
hbaseConfiguration.addResource(new Path("hbase-site.xml");
and in hbase-site.xml file add properties like ones in your conf folder of hbase installation folder on your master node.
Upvotes: 1
Reputation: 25909
Your zookeeper quorum ip adderess 10.219.47.22:60010
also specifies a port (60010) remove that
Also you have an unnecessary .
after quorum
conf.set("hbase.zookeeper.quorum", "10.219.47.22");
conf.set("hbase.zookeeper.property.clientPort", "2181");
Upvotes: 1