This topic describes how to use the HaAdmin tool to manage your E-MapReduce (EMR) cluster in high availability (HA) mode.

Prerequisites

Background information

In a version earlier than Hadoop 2.0.0, only one NameNode is deployed on each cluster. If the NameNode is unavailable, the entire cluster becomes unavailable. The cluster cannot provide services until the NameNode reestablishes a connection with the cluster.

Single-node deployment affects the availability of the cluster in the following aspects:
  • If an unexpected event occurs, such as node downtime, the cluster becomes unavailable. In this case, you must manually restart the NameNode.
  • If you perform a planned maintenance operation, such as software update or hardware upgrade, the cluster also becomes unavailable for a period of time.

The HA feature of HDFS can be used to resolve the problems. In HA mode, two NameNodes are deployed in active-standby mode. You can perform a primary/secondary switchover to restore services of the cluster in case of node downtime or during planned maintenance.

Use HaAdmin

Common commands of HaAdmin:
  • View the status of all NameNodes.
    hdfs haadmin -getAllServiceState
  • Check the health of a specified NameNode.
    hdfs haadmin -checkHealth <serviceId>
  • Initialize a failover between two NameNodes.
    hdfs haadmin -failover [--forcefence] [--forceactive] <serviceId>
  • Determine whether a specified NameNode is in the Active or Standby state.
    hdfs haadmin -getServiceStat <serviceId>
  • Switch the status of a specified NameNode to Active.
    hdfs haadmin -transitionToActive <serviceId> [--forceactive]
  • Switch the status of a specified NameNode to Standby.
    hdfs haadmin -transitionToStandby <serviceId>