Hi Harsh, thanks for your message.

The thing is that I need to find that out via API programatically so that's
why I gave the zkCli command as an example. I'm using this Go Lib (
github.com/samuel/go-zookeeper/zk) and I get the same result.

On Fri, 14 Sep 2018 at 02:22 Harsh J <[email protected]> wrote:

> 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
> <[email protected]> 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
>

Reply via email to