昨天搭建了一套hadoop集群,今天发现两个namenode的zkfc服务起不来,在zkfc日志中发现如下所示的信息:

Unable to start failover controller. Parent znode does not exist.


./bin/zkCli.sh -server master1

ls /

没有看到/hadoop-ha


解决方法:

进入hadoop namenode服务器

./bin/hdfs zkfc -formatZK


在两个namenode节点上启动zkfc服务

./sbin/hadoop-daemon.sh start zkfc


查看master1节点状态

./bin/hdfs haadmin -getServiceState master1

active


actice namenode节点转移

./bin/hdfs haadmin -failover master1 master2


查看是否转移

./bin/hdfs haadmin -getServiceState master1

standby


./bin/hdfs haadmin -getServiceState master2

active


参考:

https://blog.csdn.net/houzhizhen/article/details/44099825