Search This Blog

Enabling namenode HA using Apache ambari

In this article we will learn how to enable high availability for name node.  Nam node high availability has more than one name node. One of the name nodes will be active and it will responsible for serving user requests. Other namenodes will be in stand by mode, Standby namenodes will read meta data of active namenode continuously to be in sync with active namenode . If active namenode goes down , One of standby namenodes will become active to serve user requests that to without failing running jobs.

1) Confirm no HA enabled for Name node

By default, Hortonworks Data Platform setup will include namenode and Secondary namenode in HDFS service. In this scenario if namenode goes down , entire cluster will down and running jobs would fail. To address these issues ,We need to enable High availability (HA) for Name node.

Namenode HA will fail over to other name nodes  automatically to avoid cluster down scenarios .

The picture below confirms we have namenode and Secondary namenode in the cluster.

We need to enable Namenode HA to have active namenode and standby namenode.

2) Click enable Namenode HA under service actions

Click Enable Namenode HA to enable HA for name node. This will open namenode HA wizard.

Go to HDFS -----> click Service Actions -------> click Enable Namenode HA

3) Getting started

We need to enter nameservice ID in the first step. Nameservice ID will resolve to active namenode automatically.

All hadoop clients should use nameservice ID rather than hard coding active namenode.

4)  Select Hosts

Namenode HA wizard will install

  •     additional namenode
  •     3 journal nodes
  •     2 Zookeeper failover controllers

In this step we need to select hosts for additional namenode and journal nodes.

5) Review

This step provides complete information about what wizard is going to install and what configurations wizard is going to add/modify.

We can go back and modify things at this step if we want. Click Next to go to next step.

6) Create checkpoint

In this step , Wizard asks us to perform two things.

  •     entering namenode into safemode.
  •     creating checkpoint for namenode.

**** Please note we need to run given commands only on specified node.

Once these commands are run successful, Next button will be enabled.

7) Configure components

This step performs
  •     Stopping all services
  •     Installing additional namenode on specified host
  •     Installing journal nodes on specified hosts.
  •     Modifying configurations with required properties for Namdenode HA.
  •     Starting journal nodes
  •     Disabling secondary namenode

Click next once all these operations are completed.

8) Initialize journal nodes

This step asks us to run initializeSharedEdits command on first master node.

Once command is run on specified node , click Next

9) Start components

This step performs two things.

  •     Starts zookeeper servers
  •     Starts Namenode

Click Next once two operations completed.

10) Initialize metadata

This step asks us to run two commands on two master nodes.

  •     We need to run formatZK command on first master.
  •     We need to run bootstrapStandby command on second master.

**** Please note we need to run given commands only on specified nodes.

11) Finalize HA setup

This step performs below things.

  •   Starts additional namnode on specified node.
  •   Install Zookeeper Failover controllers on two master nodes.
  •   Starts Zookeeper Failover controllers on two master nodes.
  •   Configures AMS
  •   Deletes secondary namendoe as it is not required in namenode HA.
  •   Stops HDFS
  •   Starts all services

Click Done once above operations are completed.

12 ) Confirm name node HA is enabled

Apache Ambari reloads automatically after enabling HA for namenode, displays active namenode , standby namenode, journal nodes and Zookeeper failover controllers.

The picture below shows all of them.

Let me know if you are struck anywhere while enabling HA for namenode.