Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

namenode HA and hdfs zkfc -formatZK -force

avatar

hi all

 

 

 

We are performing now the change hostname configuration on production cluster according to the document - https://docs.cloudera.com/HDPDocuments/Ambari-2.7.0.0/administering-ambari/content/amb_changing_host...

 

The last stage is talking about – "in case NameNode HA enabled , then need to run the following command on one of the name node"

 

 

hdfs zkfc -formatZK -force

 

 

since we have active name node and standby name node we assume that our namenode is HA enable ?

 

Capture.PNG

 

but we want to understand  what are the risks when doing the following cli on one of the namenode

 

hdfs zkfc -formatZK -force

 

is the below command is safety to run without risks ?

Michael-Bronson
1 ACCEPTED SOLUTION

avatar
Master Mentor

@mike_bronson7 

Always stick to the Cloudera documentation. Yes !!! there is no risk in running that command I can understand your reservation.

 

View solution in original post

3 REPLIES 3

avatar
Expert Contributor

Hello @mike_bronson7 

 

No need to run "hdfs zkfc -formatZK -force" if you are not changing the hostname of the HDFS components like NameNode, FailoverController or ZooKeeper hosts in the cluster. 

 

The command "hdfs zkfc -formatZK" is used to initialize the HA state in ZooKeeper. This will create a znode in ZooKeeper in which the automatic failover system stores its data.

 

The example below shows the HA znode output where it stores the name of the Active NN in the cluster.

 

 

[zk: localhost:2181(CONNECTED) 3] ls /hadoop-ha/ns1
[ActiveBreadCrumb, ActiveStandbyElectorLock] <=== HA znodes in zookeeper 
[zk: localhost:2181(CONNECTED) 2] get /hadoop-ha/ns1/ActiveBreadCrumb

ns1
namenode39%nightly63x-2.nightly63x.root.hwx.site ?>(?>  <==== Active NN hostname
[zk: localhost:2181(CONNECTED) 3] 

 

 

The command "hdfs zkfc -formatZK -force" needs to run after the ZK Service is UP and running post hostname changes. 

avatar

you said that not need to run it , but the post that I mentioned say to run it , so what is right 

Michael-Bronson

avatar
Master Mentor

@mike_bronson7 

Always stick to the Cloudera documentation. Yes !!! there is no risk in running that command I can understand your reservation.