habase 报错 ERROR: Can't get master address from ZooKeeper; znode data == null
方法一:查看日志报SessionExpiredException: KeeperErrorCode = Session expired for /hbase/master
所以是hbase 和 zookeeper之间会话超时了,按照官网的常见问题说法: http://hbase.apache.org/1.2/book.html
If you wish to increase the session timeout, add the following to your hbase-site.xml(修改这个配置文件) to increase the timeout from the default of 60 seconds to 120 seconds.
<property>
<name>zookeeper.session.timeout</name>
<value>1200000</value>
</property>
<property>
<name>hbase.zookeeper.property.tickTime</name>
<value>6000</value>
</property>
然后重启hbase okay了
方法二:格式化hdfs
1 :进入Hadoop安装目录下 : ./bin/hdfs namenode –format
2:修改hbase配置文件: hbase-site.xml
<property> <name>hbase.zookeeper.property.dataDir</name> <value>/home/kevin/modules/hbase-1.3.1/zk-tmp</value> </property>
备注全部配置如下:
<configuration> <property> <name>hbase.zookeeper.property.dataDir</name> <value>/home/kevin/modules/hbase-1.3.1/zk-tmp</value> </property> <property> <name>hbase.tmp.dir</name> <value>/home/kevin/modules/hbase-1.3.1/hbase-tmp</value> </property> <property> <name>hbase.rootdir</name> <value>hdfs://linux01:8020/hbase</value> </property> <property> <name>hbase.cluster.distributed</name> <value>true</value> </property> <!-- 0.98后的新变动,之前版本没有.port,默认端口为60000 --> <property> <name>hbase.master.port</name> <value>16000</value> </property> <property> <name>hbase.zookeeper.quorum</name> <value>linux01:2181,linux02:2181,linux03:2181</value> </property> <property> <name>hbase.zookeeper.property.dataDir</name> <value>/home/admin/modules/zookeeper-3.4.5/zkData</value> </property> </configuration>
重启zookeeper,重启hadoop,重启hbase:
方法三:
jps 查看hbase集群是否启动 如果没有 hmaster hregionserver 直接开客户端 也会报同样的错误,所以先启动服务端、bin/start-hbase.sh