2

我在尝试在 5 节点 hadoop 集群中安装 Hbase 时遇到了一些问题,Hmaster 和 Hregionservers 没有运行,并且只有 Hquorumpeer 守护程序在所有 5 个节点上运行。我正在使用 hadoop-0.20.2 和 hbase-0.90.4,hadoop 工作正常。这是我的 hbase-site.xml :-

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
  <property>
    <name>hbase.zookeeper.property.clientPort</name>
    <value>2222</value>
    <description>Property from ZooKeeper's config zoo.cfg.
 The port at which the clients will connect.
    </description>
  </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>dfs.replication</name>
    <value>3</value>
  </property>
  <property>
    <name>hbase.hregion.max.filesize</name>
    <value>1048576</value>
  </property>
  <property>
    <name>hbase.zookeeper.quorum</name>
    <value>192.168.1.25,192.168.1.26,192.168.1.27,192.168.1.28,192.168.1.29</value>
  </property>
  <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/opt/data/zookeeper</value>
  </property>
  <property>
    <name>hbase.zookeeper.property.initLimit</name>
    <value>100</value>
  </property>
  <property>
    <name>hbase.zookeeper.property.syncLimit</name>
    <value>100</value>
  </property>
  <property>
    <name>zookeeper.session.timeout</name>
    <value>1200000</value>
  </property>
</configuration>  

这是我的 /etc/hosts 文件:-

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.23    adm001
192.168.1.25    master.poc.net  master hbase-master
192.168.1.28    dn2.poc.net     dn2
192.168.1.27    dn1.poc.net     dn1
192.168.1.26    dn3.poc.net     dn3
192.168.1.29    dn4.poc.net     dn4

在我的主日志中运行 Hbase 时出现以下错误

 at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1119)
2012-07-17 12:41:06,877 INFO org.apache.zookeeper.ClientCnxn: Opening socket connection to server dn3.poc.net/192.168.1.26:2222
2012-07-17 12:41:06,878 WARN org.apache.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:701)
        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1119)
2012-07-17 12:41:07,499 INFO org.apache.zookeeper.ClientCnxn: Opening socket connection to server dn2.poc.net/192.168.1.28:2222
2012-07-17 12:41:07,500 WARN org.apache.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:701)
        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1119)
2012-07-17 12:41:08,549 INFO org.apache.zookeeper.ClientCnxn: Opening socket connection to server dn1.poc.net/192.168.1.27:2222
2012-07-17 12:41:08,550 INFO org.apache.zookeeper.ClientCnxn: Socket connection established to dn1.poc.net/192.168.1.27:2222, initiating session
2012-07-17 12:41:08,554 INFO org.apache.zookeeper.ClientCnxn: Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2012-07-17 12:41:08,654 INFO org.apache.zookeeper.ClientCnxn: Opening socket connection to server dn4.poc.net/192.168.1.29:2222
2012-07-17 12:41:08,755 INFO org.apache.zookeeper.ZooKeeper: Session: 0x0 closed
2012-07-17 12:41:08,756 ERROR org.apache.hadoop.hbase.master.HMasterCommandLine: Failed to start master
java.lang.RuntimeException: Failed construction of Master: class org.apache.hadoop.hbase.master.HMaster
        at org.apache.hadoop.hbase.master.HMaster.constructMaster(HMaster.java:1064)
        at org.apache.hadoop.hbase.master.HMasterCommandLine.startMaster(HMasterCommandLine.java:142)
        at org.apache.hadoop.hbase.master.HMasterCommandLine.run(HMasterCommandLine.java:102)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
        at org.apache.hadoop.hbase.util.ServerCommandLine.doMain(ServerCommandLine.java:76)
        at org.apache.hadoop.hbase.master.HMaster.main(HMaster.java:1078)
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)
        at org.apache.hadoop.hbase.master.HMaster.<init>(HMaster.java:222)
        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:525)
        at org.apache.hadoop.hbase.master.HMaster.constructMaster(HMaster.java:1059)

我已经从 hadoop lib 文件夹中复制了 hadoop-core.jar 和其他必要的 jar 文件。

4

1 回答 1

2

通过执行以下命令打开端口 2222

iptables -A INPUT -p tcp --dport 2222 -j ACCEPT

这应该可以解决您的问题

于 2012-07-17T13:54:38.503 回答