Skip to main content
mike_bronson7
Gold ⭐️⭐️⭐️
Sep 13, 2020 4:17 PM UTC
Solved

namenode HA and hdfs zkfc -formatZK -force

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_names.html

 

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 ?

Shelton
SheltonAnswer
Gold ⭐️⭐️⭐️
Oct 10, 2020 6:35 PM UTC

@mike_bronson7 

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

 

3 replies

PabitraDas
Gold ⭐️
Gold ⭐️
Sep 29, 2020 7:26 PM UTC

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. 

Translate
mike_bronson7
Gold ⭐️⭐️⭐️
Oct 9, 2020 7:59 AM UTC

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

Translate
Michael-Bronson
Shelton
SheltonAnswer
Gold ⭐️⭐️⭐️
Oct 10, 2020 6:35 PM UTC

@mike_bronson7 

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

 

Translate