使用HBase shell时,执行命令list时出现错误:
ERROR: Can't get master address from ZooKeeper; znode data == null
即: 原因分析: 启动HBase shell前需分别依次启动Hadoop、HBase。 (1)启动Hadoop 在ubuntu终端执行以下命令
start-dfs.sh
再输入jps,出现NameNode, DataNode, SecondaryNameNode说明Hadoop正常启动。运行结果截图: (2)启动HBase
start-hbase.sh
再次输入jps查看正在运行的进程,出现以下7个进程表示HBase正常启动: 注意这里HMaster已经启动!
(3)启动HBase shell
hbase shell
进入hbase>状态后,输入list出现以下错误: ERROR: Can’t get master address from ZooKeeper; znode data == null 新建一个终端,输入jps检查运行中的终端,发现HMaster自动消失了!(泪) 在找了n种方法后依旧不行。n种方法:
- zookeeper不稳定,关闭Hadoop、HBase所有集群,重启
- 运行hbase(zookeeper)的用户无法写入zookeeper文件,导致znode data为空
- 同样出现了HMaster自动关闭的问题,ip配置
- 解决Hbase启动后,hmaster会在几秒钟后自动关闭(停掉)!!!
- 万不得已的格式化(没试过)
最后查看了logs,发现以下错误:
2022-05-15 09:46:58,170 FATAL [yike-VirtualBox:16000.activeMasterManager] master.HMaster: Master server abort: loaded coprocessors are: []
2022-05-15 09:46:58,170 FATAL [yike-VirtualBox:16000.activeMasterManager] master.HMaster: Unhandled exception. Starting shutdown.
java.lang.IllegalStateException: The procedure WAL relies on the ability to hsync for proper operation during component failures, but the underlying filesystem does not support doing so. Please check the config value of 'hbase.procedure.store.wal.use.hsync' to set the desired level of robustness and ensure the config value of 'hbase.wal.dir' points to a FileSystem mount that can provide it.
at org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore.rollWriter(WALProcedureStore.java:870)
at org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore.recoverLease(WALProcedureStore.java:328)
at org.apache.hadoop.hbase.procedure2.ProcedureExecutor.start(ProcedureExecutor.java:496)
at org.apache.hadoop.hbase.master.HMaster.startProcedureExecutor(HMaster.java:1354)
at org.apache.hadoop.hbase.master.HMaster.startServiceThreads(HMaster.java:1247)
at org.apache.hadoop.hbase.master.HMaster.finishActiveMasterInitialization(HMaster.java:795)
at org.apache.hadoop.hbase.master.HMaster.access$600(HMaster.java:211)
at org.apache.hadoop.hbase.master.HMaster$2.run(HMaster.java:2100)
at java.lang.Thread.run(Thread.java:748)
找到了一篇很牛逼的博客: https://blog.csdn.net/az9996/article/details/88946932
在我的机器上,hadoop、hbase都是配置的伪分布式,DataNode只有一个,hbase运行在LocalFileSystem(由rootdir表示),所以在配置文件(vim /usr/local/hbase/conf/hbase-site.xml)中关闭stream capabilities(hflush/hsync)功能即可。
我使用sudo vim /usr/local/hbase/conf/hbase-site.xml,在文件的里添加如下配置:
<property>
<name>hbase.unsafe.stream.capability.enforce</name>
<value>false</value>
</property>
如图: 保存退出后,再重新启动HBase和hbase shell,就可以正常执行list命令了!
|