【发布时间】:2017-05-18 03:09:27
【问题描述】:
我正在尝试以独立模式安装 HBase v1.1.2(带有 Hadoop v2.7.2),并尽可能地关注Apache HBase docs,但配置似乎有点棘手。不确定这是否与我使用自制软件安装 HBase 而不是通过他们的镜像站点之一直接下载这一事实有关。我的目标是达到可以执行诸如创建表、列出现有表等操作的程度。
我已经安装了 Java 1.7.0,并且已经运行“brew install hbase”来安装 hbase。在 Homebrew 的 hbase 目录中,我打开了 /libexec/conf/hbase-env.sh,我在第 27 行看到以下内容:
export JAVA_HOME="$(/usr/libexec/java_home)"
当我在命令行中执行/usr/libexec/java_home 时,它会输出/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home。因此,似乎设置了一个有效的 $JAVA_HOME 环境变量。
在我的/libexec/conf/hbase-site.xml 配置文件中,我设置了以下键/值对:
<configuration>
<property>
<name>hbase.rootdir</name>
<value>file:///home/richiethomas/hbase</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/home/richiethomas/zookeeper</value>
</property>
</configuration>
换句话说,我已经制作了 HBase 文档中显示的配置的精确副本,只是将“testuser”替换为“richiethomas”,因为这是我在命令行中使用的用户名。
然后在 Homebrew hbase 目录中,我运行 `./bin/start-hbase.sh'。我看到以下内容:
starting master, logging to /usr/local/Cellar/hbase/1.1.2/libexec/bin/../logs/hbase-richiethomas-master-MacBook-Pro-5.local.out
然后,我运行 hbase shell 并看到以下内容:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/Cellar/hbase/1.1.2/libexec/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/Cellar/hadoop/2.7.2/libexec/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
2017-01-03 17:27:52,056 WARN [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 1.1.2, rcc2b70cf03e3378800661ec5cab11eb43fafe0fc, Wed Aug 26 20:11:27 PDT 2015
>>
完成此操作后,在一个新的 CLI 选项卡中,我 cat 来自上面看到的路径 (/usr/local/Cellar/hbase/1.1.2/libexec/bin/../logs/hbase-richiethomas-master-MacBook-Pro-5.local.out) 的日志,我看到以下内容:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/Cellar/hbase/1.1.2/libexec/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/Cellar/hadoop/2.7.2/libexec/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
然后,回到我的 HBase shell,我运行以下命令查看是否一切正常,我看到以下内容:
>> list
TABLE
2017-01-03 17:28:05,108 ERROR [main] client.ConnectionManager$HConnectionImplementation: The node /hbase is not in ZooKeeper. It should have been written by the master. Check the value configured in 'zookeeper.znode.parent'. There could be a mismatch with the one configured in the master.
2017-01-03 17:28:05,320 ERROR [main] client.ConnectionManager$HConnectionImplementation: The node /hbase is not in ZooKeeper. It should have been written by the master. Check the value configured in 'zookeeper.znode.parent'. There could be a mismatch with the one configured in the master.
2017-01-03 17:28:05,625 ERROR [main] client.ConnectionManager$HConnectionImplementation: The node /hbase is not in ZooKeeper. It should have been written by the master. Check the value configured in 'zookeeper.znode.parent'. There could be a mismatch with the one configured in the master.
2017-01-03 17:28:06,128 ERROR [main] client.ConnectionManager$HConnectionImplementation: The node /hbase is not in ZooKeeper. It should have been written by the master. Check the value configured in 'zookeeper.znode.parent'. There could be a mismatch with the one configured in the master.
2017-01-03 17:28:07,134 ERROR [main] client.ConnectionManager$HConnectionImplementation: The node /hbase is not in ZooKeeper. It should have been written by the master. Check the value configured in 'zookeeper.znode.parent'. There could be a mismatch with the one configured in the master.
2017-01-03 17:28:09,144 ERROR [main] client.ConnectionManager$HConnectionImplementation: The node /hbase is not in ZooKeeper. It should have been written by the master. Check the value configured in 'zookeeper.znode.parent'. There could be a mismatch with the one configured in the master.
2017-01-03 17:28:13,158 ERROR [main] client.ConnectionManager$HConnectionImplementation: The node /hbase is not in ZooKeeper. It should have been written by the master. Check the value configured in 'zookeeper.znode.parent'. There could be a mismatch with the one configured in the master.
ERROR: The node /hbase is not in ZooKeeper. It should have been written by the master. Check the value configured in 'zookeeper.znode.parent'. There could be a mismatch with the one configured in the master.
Here is some help for this command:
List all tables in hbase. Optional regular expression parameter could
be used to filter the output. Examples:
hbase> list
hbase> list 'abc.*'
hbase> list 'ns:abc.*'
hbase> list 'ns:.*'
根据 Apache 文档:
您不需要创建 HBase 数据目录。 HBase 会这样做 为你。如果创建目录,HBase 将尝试执行 迁移,这不是你想要的。
我将此解释为我不需要在 hbase-site.xml 中设置以下属性,特别是因为 'hbase' 是 'zookeeper.znode.parent' 的默认值:
<property>
<name>zookeeper.znode.parent</name>
<value>/hbase</value>
</property>
jps 的输出如下:
32146 ZooKeeperMain
1364 QuorumPeerMain
83568
34120 Jps
我的zoo.cfg 文件位于/usr/local/etc/zookeeper/zoo.cfg,如下所示:
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/usr/local/var/run/zookeeper/data
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
我尝试过的解决方案:
我。
我尝试用/usr/local/var/run/zookeeper/data 替换hbase-site.xml 文件中zookeeper.property.dataDir 的值,但这并没有解决问题。
二。
当我在命令行中运行zkcli 并运行ls / 时,我只看到zookeeper,没有看到hbase 目录。我尝试在 zookeeper shell 中运行以下命令:
create /hbase my_data
然后我看到以下内容:
[zk: localhost:2181(CONNECTED) 4] ls /
[hbase, zookeeper]
然后当我退出并重新运行 HBase shell 并尝试 list 时,我看到以下内容:
>> list
TABLE
ERROR: Can't get master address from ZooKeeper; znode data == null
III.
根据this Quora article,HBase 1.1.2 仅支持 Hadoop 到 2.5.x 版本,所以我运行了brew uninstall hadoop,然后运行了brew install hadoop25,运行了停止和启动 hbase 脚本,并重新启动了 hbase shell .还是没有运气。
IV.
我尝试卸载 Homebrew 版本并从 Apache 镜像站点下载 HBase,并在 hbase-site.xml 中重复配置过程,但我得到了同样的错误 (The node /hbase is not in ZooKeeper. It should have been written by the master.)。
V.
我通过 Homebrew 卸载/重新安装了 HBase,并按照“警告”部分中的说明进行操作:
==> Caveats
To have launchd start hbase now and restart at login:
brew services start hbase
Or, if you don't want/need a background service you can just run:
/usr/local/opt/hbase/bin/start-hbase.sh
我注意到,在运行上述命令后,hbase-site.xml 文件已填充了看似合理的 hbase.rootdir 和 hbase.zookeeper.property.dataDir 值(具体来说,分别是 file:///usr/local/var/hbase 和 /usr/local/var/zookeeper)。我还注意到,当我运行brew services start hbase,然后运行jps 时,我没有看到正在运行的“HMaster”进程,但是当我运行/usr/local/opt/hbase/bin/start-hbase.sh 时确实看到了HMaster。但是,然后我尝试启动 hbase shell 并输入 status,我得到了与之前相同的错误 (The node /hbase is not in ZooKeeper.)。
六.
我已验证我的 Hadoop 安装运行正常:
MacBook-Pro-5:2.5.2 richiethomas$ hadoop jar /usr/local/Cellar/hadoop25/2.5.2/libexec/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.5.2.jar pi 2 5
Number of Maps = 2
Samples per Map = 5
17/01/03 20:09:33 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Wrote input for Map #0
Wrote input for Map #1
Starting Job
...
Job Finished in 2.156 seconds
Estimated value of Pi is 3.60000000000000000000
我的 HBase 配置似乎有问题,但我不确定这里还有什么可以尝试的。
【问题讨论】:
标签: hadoop hbase apache-zookeeper