The value you are looking at directly in ZooKeeper is in a
serialized/encoded form. Those are not separator characters but more
likely an encoded integer binary value that your terminal is
interpreting as a printable character.

The standard way to find the active NameNode is to use the 'hdfs
haadmin -getAllServiceState' command:

[hdfs@host ~]# hdfs haadmin -getAllServiceState
host1.com:8022                  standby
host2.com:8022                  active

You can then extract out just the active NameNode hostname:

[hdfs@host ~]# hdfs haadmin -getAllServiceState | grep active | awk
-F: '{ print $1; }'
host1.com
On Thu, Sep 13, 2018 at 9:39 PM Francisco de Freitas
<chicofranch...@gmail.com> wrote:
>
> When querying different HDFS clusters I get different separators (don't 
> really know if they're actually separators).
>
> From zkCli.sh on different clusters, running the following I get:
>
> cmd: get /hadoop-ha/clusterX/ActiveBreadCrumb
>
> Cluster1 (comma):
> cluster1active-nn1,active-nn1.example.com �>(�>
>
> Cluster2 (single double quote):
> cluster2active-nn2"active-nn2.example.com �>(�>
>
> Cluster3 (dollar sign):
> cluster3active-nn3$active-nn3.example.com �>(�>
>
> How can I effectively write a generic code deployed on different HDFS 
> clusters to effectively find out which is the active NN from querying ZK?
>
> Or am I doing something wrong? Is the behavior above expected?



-- 
Harsh J

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@hadoop.apache.org
For additional commands, e-mail: user-h...@hadoop.apache.org

Reply via email to