概述hbase连接被拒绝
我是HBase和Hadoop的新手。 我已经完全设置HBase,并开始完美。 现在,当我尝试使用Java客户端从p1连接到HBase(HBase设置在p2上 )时,它抛出了一个奇怪的exception。
12/04/17 14:36:37 INFO zookeeper.ZooKeeper: Initiating clIEnt connection,connectString=192.168.15.20:2181 sessionTimeout=180000 watcher=hconnection 12/04/17 14:36:38 INFO zookeeper.ClIEntCnxn: opening socket connection to server /192.168.15.20:2181 12/04/17 14:36:38 WARN zookeeper.ClIEntCnxn: Session 0x0 for server null,unexpected error,closing socket connection and attempting reconnect java.net.ConnectException: Connection refused at sun.nio.ch.socketChannelimpl.checkConnect(Native Method) at sun.nio.ch.socketChannelimpl.finishConnect(SocketChannelimpl.java:567) at org.apache.zookeeper.ClIEntCnxn$SendThread.run(ClIEntCnxn.java:1119) 12/04/17 14:36:39 INFO zookeeper.ClIEntCnxn: opening socket connection to server hbase.local/192.168.15.20:2181 12/04/17 14:36:39 WARN zookeeper.ClIEntCnxn: Session 0x0 for server null,closing socket connection and attempting reconnect java.net.ConnectException: Connection refused at sun.nio.ch.socketChannelimpl.checkConnect(Native Method) at sun.nio.ch.socketChannelimpl.finishConnect(SocketChannelimpl.java:567) at org.apache.zookeeper.ClIEntCnxn$SendThread.run(ClIEntCnxn.java:1119) 12/04/17 14:36:41 INFO zookeeper.ClIEntCnxn: opening socket connection to server hbase.local/192.168.15.20:2181 12/04/17 14:36:41 WARN zookeeper.ClIEntCnxn: Session 0x0 for server null,closing socket connection and attempting reconnect java.net.ConnectException: Connection refused at sun.nio.ch.socketChannelimpl.checkConnect(Native Method) at sun.nio.ch.socketChannelimpl.finishConnect(SocketChannelimpl.java:567) at org.apache.zookeeper.ClIEntCnxn$SendThread.run(ClIEntCnxn.java:1119) 12/04/17 14:36:43 INFO zookeeper.ClIEntCnxn: opening socket connection to server hbase.local/192.168.15.20:2181 12/04/17 14:36:43 WARN zookeeper.ClIEntCnxn: Session 0x0 for server null,closing socket connection and attempting reconnect java.net.ConnectException: Connection refused at sun.nio.ch.socketChannelimpl.checkConnect(Native Method) at sun.nio.ch.socketChannelimpl.finishConnect(SocketChannelimpl.java:567) at org.apache.zookeeper.ClIEntCnxn$SendThread.run(ClIEntCnxn.java:1119) 12/04/17 14:36:44 INFO zookeeper.ClIEntCnxn: opening socket connection to server hbase.local/192.168.15.20:2181 12/04/17 14:36:44 WARN zookeeper.ClIEntCnxn: Session 0x0 for server null,closing socket connection and attempting reconnect java.net.ConnectException: Connection refused at sun.nio.ch.socketChannelimpl.checkConnect(Native Method) at sun.nio.ch.socketChannelimpl.finishConnect(SocketChannelimpl.java:567) at org.apache.zookeeper.ClIEntCnxn$SendThread.run(ClIEntCnxn.java:1119) 12/04/17 14:36:45 INFO zookeeper.ClIEntCnxn: opening socket connection to server hbase.local/192.168.15.20:2181 12/04/17 14:36:45 WARN zookeeper.ClIEntCnxn: Session 0x0 for server null,closing socket connection and attempting reconnect java.net.ConnectException: Connection refused at sun.nio.ch.socketChannelimpl.checkConnect(Native Method) at sun.nio.ch.socketChannelimpl.finishConnect(SocketChannelimpl.java:567) at org.apache.zookeeper.ClIEntCnxn$SendThread.run(ClIEntCnxn.java:1119) 12/04/17 14:36:47 INFO zookeeper.ClIEntCnxn: opening socket connection to server hbase.local/192.168.15.20:2181 12/04/17 14:36:47 WARN zookeeper.ClIEntCnxn: Session 0x0 for server null,closing socket connection and attempting reconnect java.net.ConnectException: Connection refused at sun.nio.ch.socketChannelimpl.checkConnect(Native Method) at sun.nio.ch.socketChannelimpl.finishConnect(SocketChannelimpl.java:567) at org.apache.zookeeper.ClIEntCnxn$SendThread.run(ClIEntCnxn.java:1119) 12/04/17 14:36:48 INFO zookeeper.ClIEntCnxn: opening socket connection to server hbase.local/192.168.15.20:2181 12/04/17 14:36:48 WARN zookeeper.ClIEntCnxn: Session 0x0 for server null,closing socket connection and attempting reconnect java.net.ConnectException: Connection refused at sun.nio.ch.socketChannelimpl.checkConnect(Native Method) at sun.nio.ch.socketChannelimpl.finishConnect(SocketChannelimpl.java:567) at org.apache.zookeeper.ClIEntCnxn$SendThread.run(ClIEntCnxn.java:1119) 12/04/17 14:36:49 INFO zookeeper.ClIEntCnxn: opening socket connection to server hbase.local/192.168.15.20:2181 12/04/17 14:36:49 INFO zookeeper.ZooKeeper: Session: 0x0 closed org.apache.hadoop.hbase.ZooKeeperconnectionexception: HBase is able to connect to ZooKeeper but the connection closes immediately. This Could be a sign that the server has too many connections (30 is the default). ConsIDer inspecting your ZK server logs for that error and then make sure you are reusing HBaseConfiguration as often as you can. See Htable\’s javadoc for more information. at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.<init>(ZooKeeperWatcher.java:155) at org.apache.hadoop.hbase.clIEnt.HConnectionManager$HConnectionImplementation.getZooKeeperWatcher(HConnectionManager.java:1002) at org.apache.hadoop.hbase.clIEnt.HConnectionManager$HConnectionImplementation.setupZookeeperTrackers(HConnectionManager.java:304) at org.apache.hadoop.hbase.clIEnt.HConnectionManager$HConnectionImplementation.<init>(HConnectionManager.java:295) at org.apache.hadoop.hbase.clIEnt.HConnectionManager.getConnection(HConnectionManager.java:157) at org.apache.hadoop.hbase.clIEnt.HBaseadmin.<init>(HBaseadmin.java:90) at org.apache.hadoop.hbase.clIEnt.HBaseadmin.checkHBaseAvailable(HBaseadmin.java:1258) at HBaseDemo.main(HBaseDemo.java:55) Caused by: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase at org.apache.zookeeper.KeeperException.create(KeeperException.java:90) at org.apache.zookeeper.KeeperException.create(KeeperException.java:42) at org.apache.zookeeper.ZooKeeper.exists(ZooKeeper.java:809) at org.apache.zookeeper.ZooKeeper.exists(ZooKeeper.java:837) at org.apache.hadoop.hbase.zookeeper.ZKUtil.createAndFailSilent(ZKUtil.java:903) at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.<init>(ZooKeeperWatcher.java:133) … 7 more 12/04/17 14:36:49 INFO zookeeper.ClIEntCnxn: EventThread shut down Execution script exiting
/04/17 17:41:35 INFO zookeeper.ZooKeeper: ClIEnt environment:user.name=xyz 12/04/17 17:41:35 INFO zookeeper.ZooKeeper: ClIEnt environment:user.home=/home/xyz 12/04/17 17:41:35 INFO zookeeper.ZooKeeper: ClIEnt environment:user.dir=/opt/xyz/hbase-sample 12/04/17 17:41:35 INFO zookeeper.ZooKeeper: Initiating clIEnt connection,connectString=192.168.15.169:2181 sessionTimeout=180000 watcher=hconnection 12/04/17 17:41:35 INFO zookeeper.ClIEntCnxn: opening socket connection to server /192.168.15.169:2181 12/04/17 17:41:35 INFO zookeeper.ClIEntCnxn: Socket connection established to hbase.xyz.com/192.168.15.169:2181,initiating session 12/04/17 17:41:35 INFO zookeeper.ClIEntCnxn: Session establishment complete on server hbase.xyz.com/192.168.15.169:2181,sessionID = 0x136c00d59ac0009,negotiated timeout = 180000 12/04/17 17:41:36 INFO clIEnt.HConnectionManager$HConnectionImplementation: getMaster attempt 0 of 1 Failed; no more retrying. java.net.ConnectException: Connection refused at sun.nio.ch.socketChannelimpl.checkConnect(Native Method) at sun.nio.ch.socketChannelimpl.finishConnect(SocketChannelimpl.java:567) at org.apache.hadoop.net.socketIOWithTimeout.connect(SocketIOWithTimeout.java:206) at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:604) at org.apache.hadoop.hbase.ipc.HBaseClIEnt$Connection.setupIOstreams(HBaseClIEnt.java:328) at org.apache.hadoop.hbase.ipc.HBaseClIEnt.getConnection(HBaseClIEnt.java:883) at org.apache.hadoop.hbase.ipc.HBaseClIEnt.call(HBaseClIEnt.java:750) at org.apache.hadoop.hbase.ipc.HBaseRPC$Invoker.invoke(HBaseRPC.java:257) at $Proxy4.getProtocolVersion(UnkNown Source) at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:419) at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:393) at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:444) at org.apache.hadoop.hbase.clIEnt.HConnectionManager$HConnectionImplementation.getMaster(HConnectionManager.java:360) at org.apache.hadoop.hbase.clIEnt.HBaseadmin.<init>(HBaseadmin.java:94) at org.apache.hadoop.hbase.clIEnt.HBaseadmin.checkHBaseAvailable(HBaseadmin.java:1258) at HBaseDemo.main(HBaseDemo.java:55) HBase is not running! Execution script exiting
我找到了解决办法。
只需从我的/etc/hosts删除localhost条目即可。 现在我的本地主机条目是192.169.19.50 [这是我的hbase IP] = localhost而不是127.0.0.1本地主机。
这里接受的答案可能会起作用,但只能作为一个副作用。
问题是HBase正在打开一个监听本地主机(即回环)而不是外部接口的端口。 删除/ etc / hosts中的localhost条目会强制HBase绑定到外部接口 – 但仅仅是因为找不到localhost。 当一些守护进程想合法地监听或单独连接到localhost(通过lo)时,这可能会成为一个问题。
您可以使用telnet通过本地主机或分配给本机的IP连接到端口60000来测试是否存在此问题。 很有可能你可以通过本地主机连接(因为这是绑定HBase的地方),而不是IP。
最好在你的HBase conf中使用你的机器名称。
假设您已经为您的HBase实例化配置,请设置hbase master,zookeeper quorum和znode父级。 有点像这样 –
import org.apache.hadoop.hbase.HBaseConfiguration; public class CLASS_name{ Configuration configuration = new HBaseConfiguration.Create(); configuration.set(hbase master,\”\”); configuration.set(zookeeper quorum,\”\”); configuration.set(znode parent,\”\”); }
总结
以上是内存溢出为你收集整理的hbase连接被拒绝全部内容,希望文章能够帮你解决hbase连接被拒绝所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
请登录后查看评论内容