Hadoop get active namenode

Few hadoop commands to get namenode information

List the namenode hostnames

[email protected][~] hdfs getconf -namenodes
dw-master01.cstest.com dw-master02.cstest.com

Get nameservice name

[email protected][~] hdfs getconf -confKey dfs.nameservices
nameservice1

Get active and standby namenodes

[email protected][~] hdfs getconf -confKey dfs.ha.namenodes.nameservice1
namenode70,namenode95

[email protected][~] hdfs haadmin -getServiceState namenode70
active
[email protected][~] hdfs haadmin -getServiceState namenode95
standby

Get active and standby namenode hostnames

[email protected][~] hdfs getconf -confKey dfs.namenode.rpc-address.nameservice1.namenode70
dw-master01.cstest.com:8020

[email protected][~] hdfs getconf -confKey dfs.namenode.rpc-address.nameservice1.namenode95
dw-master02.cstest.com:8020

 

If you want to get the active namenode hostname from hdfs-site.xml file, you can go through following python script in github – https://github.com/grakala/getActiveNN.

 

Leave a Reply

Your email address will not be published. Required fields are marked *