Any command to get active namenode for nameservice in hadoop?

后端 未结 10 1437
情歌与酒
情歌与酒 2020-12-13 22:08

The command:

hdfs haadmin -getServiceState machine-98

Works only if you know the machine name. Is there any command like:

h         


        
10条回答
  •  离开以前
    2020-12-13 22:28

    In a High Availability Hadoop cluster, there will be 2 namenodes - one active and one standby.

    To find the active namenode, we can try executing the test hdfs command on each of the namenodes and find the active name node corresponding to the successful run.

    Below command executes successfully if the name node is active and fails if it is a standby node.

    hadoop fs -test -e hdfs:///
    

    Unix script

    active_node=''
    if hadoop fs -test -e hdfs:/// ; then
    active_node=''
    elif hadoop fs -test -e hdfs:/// ; then
    active_node=''
    fi
    
    echo "Active Dev Name node : $active_node"
    

提交回复
热议问题