2013-11-15 72 views
0

您好我正嘗試從我的java程序連接到遠程計算機中的hbase。但我得到連接拒絕錯誤。在看看這個錯誤,我認爲它試圖連接到我的本地主機而不是遠程機器。無法從java程序連接到遠程hbase

我的配置是喜歡 -

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打開。我得到了以下result-

java  18854   root 266u IPv6 6199707  0t0 TCP 127.0.0.1:47000->127.0.0.1:2181 (CLOSE_WAIT) 

回答

1

你的動物園管理員法定人數IP adderess 10.219.47.22:60010還指定了一個端口(60010)刪除 還你以後不必要的.法定人數

conf.set("hbase.zookeeper.quorum", "10.219.47.22"); 
conf.set("hbase.zookeeper.property.clientPort", "2181"); 
1

的60010端口是隻爲web ui不能連接。 檢查此代碼段可以幫助你:

Configuration hbaseConfiguration = HBaseConfiguration.create(); 
hbaseConfiguration.addResource(new Path("hbase-site.xml"); 

和HBase的-site.xml文件中添加喜歡在HBase的安裝文件夾中的conf文件夾的人你的主節點上的性能。