我有two linux
一台机器是master machine(192.168.8.174)
,另一台是slave1 machine(192.168.8.173)
。我已经成功安装并配置Hadoop 2.6.0
了完全分布式模式。Hadoop 输出也完美呈现。我安装并配置了HBase 1.0
.i 使用hbase default zookeeper
.i didn't installed separate zookeeper
。当我启动 hbase 时,它会显示hbase log file
如下 错误
2015-03-21 09:23:15,676 INFO [main] zookeeper.ZooKeeper: Client environment:user.name=master
2015-03-21 09:23:15,676 INFO [main] zookeeper.ZooKeeper: Client environment:user.home=/home/master
2015-03-21 09:23:15,676 INFO [main] zookeeper.ZooKeeper: Client environment:user.dir=/home/master
2015-03-21 09:23:15,682 INFO [main] zookeeper.ZooKeeper: Initiating client connection, connectString=slave1:2222,master:2222 sessionTimeout=90000 watcher=master:160200x0, quorum=slave1:2222,master:2222, baseZNode=/hbase
2015-03-21 09:23:15,762 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Opening socket connection to server master/192.168.8.174:2222. Will not attempt to authenticate using SASL (unknown error)
2015-03-21 09:23:15,783 WARN [main-SendThread(master:2222)] 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:739)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
2015-03-21 09:23:15,899 INFO [main-SendThread(slave1:2222)] zookeeper.ClientCnxn: Opening socket connection to server slave1/192.168.8.173:2222. Will not attempt to authenticate using SASL (unknown error)
2015-03-21 09:23:15,900 WARN [main-SendThread(slave1:2222)] 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:739)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
2015-03-21 09:23:15,907 WARN [main] zookeeper.RecoverableZooKeeper: Possibly transient ZooKeeper, quorum=slave1:2222,master:2222, exception=org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase
2015-03-21 09:23:15,908 INFO [main] util.RetryCounter: Sleeping 1000ms before retry #0...
2015-03-21 09:23:17,006 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Opening socket connection to server master/192.168.8.174:2222. Will not attempt to authenticate using SASL (unknown error)
2015-03-21 09:23:17,007 WARN [main-SendThread(master:2222)] 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:739)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
2015-03-21 09:23:17,108 INFO [main-SendThread(slave1:2222)] zookeeper.ClientCnxn: Opening socket connection to server slave1/192.168.8.173:2222. Will not attempt to authenticate using SASL (unknown error)
2015-03-21 09:23:17,108 WARN [main-SendThread(slave1:2222)] 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:739)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
2015-03-21 09:23:17,109 WARN [main] zookeeper.RecoverableZooKeeper: Possibly transient ZooKeeper, quorum=slave1:2222,master:2222, exception=org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase
2015-03-21 09:23:17,109 INFO [main] util.RetryCounter: Sleeping 2000ms before retry #1...
2015-03-21 09:23:18,210 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Opening socket connection to server master/192.168.8.174:2222. Will not attempt to authenticate using SASL (unknown error)
2015-03-21 09:23:18,210 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Socket connection established to master/192.168.8.174:2222, initiating session
2015-03-21 09:23:18,226 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2015-03-21 09:23:18,793 INFO [main-SendThread(slave1:2222)] zookeeper.ClientCnxn: Opening socket connection to server slave1/192.168.8.173:2222. Will not attempt to authenticate using SASL (unknown error)
2015-03-21 09:23:18,795 WARN [main-SendThread(slave1:2222)] 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:739)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
2015-03-21 09:23:20,568 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Opening socket connection to server master/192.168.8.174:2222. Will not attempt to authenticate using SASL (unknown error)
2015-03-21 09:23:20,570 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Socket connection established to master/192.168.8.174:2222, initiating session
2015-03-21 09:23:20,572 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2015-03-21 09:23:20,672 WARN [main] zookeeper.RecoverableZooKeeper: Possibly transient ZooKeeper, quorum=slave1:2222,master:2222, exception=org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase
2015-03-21 09:23:20,672 INFO [main] util.RetryCounter: Sleeping 4000ms before retry #2...
2015-03-21 09:23:21,418 INFO [main-SendThread(slave1:2222)] zookeeper.ClientCnxn: Opening socket connection to server slave1/192.168.8.173:2222. Will not attempt to authenticate using SASL (unknown error)
2015-03-21 09:23:21,419 WARN [main-SendThread(slave1:2222)] 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:739)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
2015-03-21 09:23:23,116 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Opening socket connection to server master/192.168.8.174:2222. Will not attempt to authenticate using SASL (unknown error)
2015-03-21 09:23:23,116 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Socket connection established to master/192.168.8.174:2222, initiating session
2015-03-21 09:23:23,118 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2015-03-21 09:23:23,851 INFO [main-SendThread(slave1:2222)] zookeeper.ClientCnxn: Opening socket connection to server slave1/192.168.8.173:2222. Will not attempt to authenticate using SASL (unknown error)
2015-03-21 09:23:23,852 WARN [main-SendThread(slave1:2222)] 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:739)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
2015-03-21 09:23:24,961 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Opening socket connection to server master/192.168.8.174:2222. Will not attempt to authenticate using SASL (unknown error)
2015-03-21 09:23:24,962 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Socket connection established to master/192.168.8.174:2222, initiating session
2015-03-21 09:23:24,964 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2015-03-21 09:23:25,064 WARN [main] zookeeper.RecoverableZooKeeper: Possibly transient ZooKeeper, quorum=slave1:2222,master:2222, exception=org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase
2015-03-21 09:23:25,064 INFO [main] util.RetryCounter: Sleeping 8000ms before retry #3...
2015-03-21 09:23:25,992 INFO [main-SendThread(slave1:2222)] zookeeper.ClientCnxn: Opening socket connection to server slave1/192.168.8.173:2222. Will not attempt to authenticate using SASL (unknown error)
2015-03-21 09:23:25,994 WARN [main-SendThread(slave1:2222)] 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:739)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
2015-03-21 09:23:28,070 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Opening socket connection to server master/192.168.8.174:2222. Will not attempt to authenticate using SASL (unknown error)
2015-03-21 09:23:28,071 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Socket connection established to master/192.168.8.174:2222, initiating session
2015-03-21 09:23:28,072 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2015-03-21 09:23:28,344 INFO [main-SendThread(slave1:2222)] zookeeper.ClientCnxn: Opening socket connection to server slave1/192.168.8.173:2222. Will not attempt to authenticate using SASL (unknown error)
2015-03-21 09:23:28,345 WARN [main-SendThread(slave1:2222)] 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:739)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
2015-03-21 09:23:29,843 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Opening socket connection to server master/192.168.8.174:2222. Will not attempt to authenticate using SASL (unknown error)
2015-03-21 09:23:29,844 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Socket connection established to master/192.168.8.174:2222, initiating session
2015-03-21 09:23:29,845 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2015-03-21 09:23:30,925 INFO [main-SendThread(slave1:2222)] zookeeper.ClientCnxn: Opening socket connection to server slave1/192.168.8.173:2222. Will not attempt to authenticate using SASL (unknown error)
2015-03-21 09:23:30,926 WARN [main-SendThread(slave1:2222)] 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:739)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
2015-03-21 09:23:32,241 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Opening socket connection to server master/192.168.8.174:2222. Will not attempt to authenticate using SASL (unknown error)
2015-03-21 09:23:32,242 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Socket connection established to master/192.168.8.174:2222, initiating session
2015-03-21 09:23:32,243 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2015-03-21 09:23:32,445 INFO [main-SendThread(slave1:2222)] zookeeper.ClientCnxn: Opening socket connection to server slave1/192.168.8.173:2222. Will not attempt to authenticate using SASL (unknown error)
2015-03-21 09:23:32,446 WARN [main-SendThread(slave1:2222)] 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:739)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
2015-03-21 09:23:34,335 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Opening socket connection to server master/192.168.8.174:2222. Will not attempt to authenticate using SASL (unknown error)
2015-03-21 09:23:34,337 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Socket connection established to master/192.168.8.174:2222, initiating session
2015-03-21 09:23:34,339 INFO [main-SendThread(master:2222)] zookeeper.ClientCnxn: Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2015-03-21 09:23:34,440 WARN [main] zookeeper.RecoverableZooKeeper: Possibly transient ZooKeeper, quorum=slave1:2222,master:2222, exception=org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase
2015-03-21 09:23:34,440 ERROR [main] zookeeper.RecoverableZooKeeper: ZooKeeper create failed after 4 attempts
2015-03-21 09:23:34,440 ERROR [main] master.HMasterCommandLine: Master exiting
java.lang.RuntimeException: Failed construction of Master: class org.apache.hadoop.hbase.master.HMaster
at org.apache.hadoop.hbase.master.HMaster.constructMaster(HMaster.java:1982)
at org.apache.hadoop.hbase.master.HMasterCommandLine.startMaster(HMasterCommandLine.java:198)
at org.apache.hadoop.hbase.master.HMasterCommandLine.run(HMasterCommandLine.java:139)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.hadoop.hbase.util.ServerCommandLine.doMain(ServerCommandLine.java:126)
at org.apache.hadoop.hbase.master.HMaster.main(HMaster.java:1996)
Caused by: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase
at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:783)
at org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper.createNonSequential(RecoverableZooKeeper.java:512)
at org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper.create(RecoverableZooKeeper.java:491)
at org.apache.hadoop.hbase.zookeeper.ZKUtil.createWithParents(ZKUtil.java:1252)
at org.apache.hadoop.hbase.zookeeper.ZKUtil.createWithParents(ZKUtil.java:1230)
at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.createBaseZNodes(ZooKeeperWatcher.java:174)
at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.<init>(ZooKeeperWatcher.java:167)
at org.apache.hadoop.hbase.regionserver.HRegionServer.<init>(HRegionServer.java:531)
at org.apache.hadoop.hbase.master.HMaster.<init>(HMaster.java:333)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.apache.hadoop.hbase.master.HMaster.constructMaster(HMaster.java:1977)
... 5 more
但是当我使用它时jps
它在命令提示符下运行,如下所示
master machine slave1 machine
HMaster HQuorumpeer
HQuorumpeer RegionServer
HRegionServer
我的hbase configuration files
是
主机 -hbase-site.xml
<configuration>
<property>
<name>hbase.master</name>
<value>master:9000</value>
</property>
<property>
<name>hbase.rootdir</name>
<value>hdfs://master:54310/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/home/master/hbase/zookeeper</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>master,slave1</value>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2181</value>
</property>
</configuration>
从机1 -hbase-site.xml
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://master:54310/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
</configuration>
和
master /etc/hosts
192.168.8.174 master
192.168.8.173 slave1
slave1 /etc/hosts
192.168.8.174 master
192.168.8.173 slave1
我在 hbase-env.sh 中测试了 HBASE_MANAGES_ZK 的布尔值是 true 还是 false,但仍然找不到
我不知道我错误地给出了一些解决方案..
答案1
我收到 /hbase 异常的 KeeperErrorCode = ConnectionLoss,但以下配置对我有用:在 hbase-env.sh 中更改:
export HBASE_MANAGES_ZK=true
在 ams-hbase-site 中进行以下更改:
<configuration>
<property>
<name>hbase.zookeeper.quorum</name>
<value>zknode1,zknode2,zknode3,zknode4</value>
</property>
<property>
<name>hbase.rootdir</name>
<value>hdfs://localhost:8020/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2181</value>
</property>
</configuration>
在 hbase.zookeeper.quorum 中添加所有 zookeeper 节点。
If above config not work for you then add following property in Advanced ams-hbase-security-site:
zookeeper.znode.parent= /hbase