简体   繁体   English

无法通过Java代码远程连接Hbase

[英]Unable to connect Hbase remotely by java code

I have installed HBase on Linux Machine(192.168.1.000) and now I have written some sample Code in Eclipse IDE on same linux Machine using JAVA API to communicate with HBase and it's working fine but when I written same java code on windows machine in same version of Ecliple IDE to communicate with HBase on Linux Machine(192.168.1.000). 我已经在Linux机器(192.168.1.000)上安装了HBase,现在我已经在同一Linux机器上使用JAVA API与HBase通信在Eclipse IDE中编写了一些示例代码,并且工作正常,但是当我在同一Windows机器上编写相同的Java代码时版本的Ecliple IDE与Linux Machine(192.168.1.000)上的HBase通信。 I got: 我有:

14/12/02 15:42:40 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the            default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may     ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
14/12/02 15:42:40 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error,     closing socket connection and attempting reconnect
java.net.BindException: Cannot assign requested address: 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:286)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1035)
14/12/02 15:42:40 WARN zookeeper.RecoverableZooKeeper: Possibly transient ZooKeeper exception:     org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for    /hbase/master
14/12/02 15:42:40 INFO util.RetryCounter: The 1 times to retry  after sleeping 2000 ms

whereas my code is: 而我的代码是:

Configuration config = HBaseConfiguration.create();
config.clear();
config.set("hbase.zookeeper.quorum", "192.168.1.000");
config.set("hbase.zookeeper.property.clientPort","2181");
config.set("hbase.master", "192.168.1.000:60030");
HBaseAdmin hbAdmin = new HBaseAdmin(config);`enter code here`

Please help me to get out from here: 请帮助我从这里离开:

Thanks in advance Abhinav kumar 在此先感谢Abhinav kumar

BindException from your stacktrace is when you try to run your hbase, it will start a co-ordinator service on port 2181 ie zookeeper but as the port might already been in use by some other process, it throws BindException. 来自stacktrace的BindException是当您尝试运行hbase时,它将在端口2181(即zookeeper)上启动协调器服务,但是由于该端口可能已被其他进程使用,因此它将引发BindException。

Change the port and retry. 更改端口,然后重试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM