Monday 28 September 2015

Hadoop 2: HA Administration using the haadmin command

This post is a continuation of my previous post, regarding Hadoop 2 deployment with HA.

While administrating HA environment in Hadoop 2, it is necessary to know commands to check the health of the environment.

 HA Administration using the "haadmin" command:

getServiceState:  Determine whether the given NameNode is Active or Standby. This subcommand connects to the provided NameNode, determines its current state, and prints either "standby" or "active".  This command is useful, while developing monitoring scripts to get the state of service.



The above snapshots provides the example, here

nn1------> hadoop-master-test
nn2------>hadoop-secondary-test

these values are provided in "hdfs-site.xml" of hadoop.

checkHealth- This subcommand check the health of the given NameNode

Connect to the provided NameNode to check its health. The NameNode is capable of performing some diagnostics on itself, including checking if internal services are running as expected. This command will return 0 if the NameNode is healthy, non-zero otherwise. One might use this command for monitoring purposes.

Note: The checkHealth command is not yet implemented, and at present will always return success, unless the given NameNode is completely down.

failover - This subcommand initiate a failover between two NameNodes.

This subcommand causes a failover from the first provided NameNode to the second. If the first NameNode is in the Standby state, this command simply transitions the second to the Active state without error. If the first NameNode is in the Active state, an attempt will be made to gracefully transition it to the Standby state. If this fails, the fencing methods (as configured by dfs.ha.fencing.methods) will be attempted in order until one of the methods succeeds. Only after this process will the second NameNode be transitioned to the Active state. If no fencing method succeeds, the second NameNode will not be transitioned to the Active state, and an error will be returned.

Syntax:
--------
hdfs haadmin -failover <Active Node> <Standby Node>
--------

Example:  In the following snapshot, by issuing the command in the shell. Namenode "nn1", which was in active state switched to standby. The Namenode "nn2" became standby. This proves that, our
cluster failover is working fine.

Kool :)

No comments:

Post a Comment

Note: only a member of this blog may post a comment.