在Mac OSX上,HBase无法以单节点群集模式启动

时间:2015-09-26 19:04:07

标签: hadoop hbase apache-zookeeper

我正在尝试设置个人HBase开发环境。我有hdfs和纱线运行,但无法启动HBase。

我通过运行start-dfs.sh和start-yarn.sh启动了hadoop 2.7.1。我已通过测试hdfs dfs -mkdir / test并运行示例中捆绑的示例MR作业验证了这些正在运行,我在端口50070浏览了HDFS。

我在端口2181上启动了zookeeper 3.4.6并设置了dataDir。我的zoo.cfg有:

dataDir=/Users/.../tools/hd/zookeeper_data
clientPort=2181

我在我选择的dataDir中观察它的zookeeper_server.PID文件,当我运行jps时,我看到如下:

51074 NodeManager
50743 DataNode
50983 ResourceManager
50856 SecondaryNameNode
57848 QuorumPeerMain
58731 Jps
50653 NameNode

上面的QuorumPeerMain匹配zookeeper_server.PID中的PID,正如我所料。这种期望是否正确?从我到目前为止所做的,是否应该在这里展示更多的流程?

我安装了hbase-1.1.2。我配置hbase-site.xml。我将hbase.rootDir设置为hdfs:// localhost:8200 / hbase,我的hdfs在localhost:8200运行。我将hbase.zookeeper.property.dataDir设置为我的zookeeper的dataDir,期望它将使用此属性来查找正在运行的zookeeper的PID。这种期望是正确的还是我被误解了? hbase-site.xml中的配置为:

<property>
<name>hbase.rootdir</name>
<value>hdfs://localhost:8020/hbase</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>Users/.../tools/hd/zookeeper_data</value>
</property>

当我运行start-hbase.sh时,我的服务器无法启动。我看到这条日志消息:

2015-09-26 19:32:43,617 ERROR [main] master.HMasterCommandLine: Master exiting

要调查我运行hbase master start并获取更多详细信息:

2015-09-26 19:41:26,403 INFO [Thread-1] server.NIOServerCnxn: Stat command output 2015-09-26 19:41:26,405 INFO [Thread-1] server.NIOServerCnxn: Closed socket connection for client /127.0.0.1:63334 (no session established for client) 2015-09-26 19:41:26,406 INFO [main] zookeeper.MiniZooKeeperCluster: Started MiniZooKeeperCluster and ran successful 'stat' on client port=2182 Could not start ZK at requested port of 2181. ZK was started at port: 2182. Aborting as clients (e.g. shell) will not be able to find this ZK quorum. 2015-09-26 19:41:26,406 ERROR [main] master.HMasterCommandLine: Master exiting java.io.IOException: Could not start ZK at requested port of 2181. ZK was started at port: 2182. Aborting as clients (e.g. shell) will not be able to find this ZK quorum. at org.apache.hadoop.hbase.master.HMasterCommandLine.startMaster(HMasterCommandLine.java:214) 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:2304)

所以我有几个问题:

  1. 我应该在运行HBase之前尝试设置zookeeper吗?
  2. 为什么当我启动一个动物园管理员并告诉HBase其dataDir在哪里时,HBase是否会尝试启动自己的zookeeper?
  3. 上面有什么明显的愚蠢/误导?

2 个答案:

答案 0 :(得分:2)

用于启动hbase start-hbase.sh的脚本将尝试按顺序启动以下组件:

  • 动物园管理员
  • hbase master
  • hbase regionserver
  • hbase master-backup

所以,您可以停止由您启动的zookeeper(或)您可以自己启动守护进程:

# start hbase master
bin/hbase-daemon.sh --config ${HBASE_CONF_DIR} start master
# start region server
bin/hbase-daemons.sh --config ${HBASE_CONF_DIR} --hosts ${HBASE_CONF_DIR}/regionservers start regionserver

答案 1 :(得分:0)

HBase独立启动它是自己的zookeeper(如果运行start-hbase.sh),但是如果启动失败或无法继续运行,则其他需要的hbase守护程序将无法工作。

确保在lo0文件中为接口hbase-site.xml明确设置属性:

<property>
  <name>hbase.zookeeper.dns.interface</name>
  <value>lo0</value>
</property>

<property>
  <name>hbase.regionserver.dns.interface</name>
  <value>lo0</value>
</property>

<property>
  <name>hbase.master.dns.interface</name>
  <value>lo0</value>
</property>

我发现当我的wifi开启时,如果缺少这些条目,则Zookeeper会开始启动。