Changing a nameservice name for Highly Available HDFS using Cloudera Manager

Based on your requirements, you can change a nameservice name for a cluster that has HDFS HA configured.

Before you start, make note of the NameNode data directory and JournalNode edits directory. You can find dfs.namenode.name.dir and dfs.journalnode.edits.dir from the configuration of HDFS service in the Cloudera Manager Admin Console.

Cloudera recommends you to take a backup for the above directories so that if there is any operator error, you still have a chance to recover.

In this example, the following values are assumed:
  • The current nameservice name is nameservice1.
  • The NameNode data directory is /data/dfs/nn.
  • The JournalNode edits directory is /data/dfs/jn.
  1. Ensure that both NameNodes enter safemode and you save the current namespace and merge all the recent edits to the same fsimage id for both NameNodes.
    1. Go to HDFS service > Instance.
    2. Click NameNodes (Active) > Actions > Enter Safemode.
    3. Click NameNodes (Active) > Actions > Save Namespace.
    4. Click NameNodes (Standby) > Actions > Enter Safemode.
    5. Click NameNodes (Standby) > Actions > Save Namespace.
    6. ssh to both NameNodes data directories to ensure that the same fsimage is generated.
  2. Delete the current nameservice znode from ZooKeeper CLI.
    1. Stop all services except ZooKeeper.
    2. On a ZooKeeper host, run zookeeper-client.
    3. Execute the following to remove the configured nameservice:
      deleteall /hadoop-ha/nameservice1

      Login as ZooKeeper super user if Kerberos is enabled, so that you have the authorization to delete the protected znodes.

  3. In the Cloudera Manager Admin Console, change the NameNode nameservice name.
    1. Go to the HDFS service.
    2. Click Configuration.
    3. Type nameservice in the Search field.
    4. For the NameNode Nameservice property, change the nameservice name in the NameNode (instance_name) field.
      The name must be unique and can contain only alphanumeric characters.
    5. Type quorum in the Search field.
    6. For the Quorum-based Storage Journal name property, change the nameservice name in the NameNode (instance_name) field.
    7. Save changes.
  4. Create a new nameservice znode.
    1. Click Instances.
    2. In the Federation and High Availability pane, select Actions > Initialize High Availability State in ZooKeeper.
    3. On a ZooKeeper host, run zookeeper-client and verify that the new nameservice znode is created.
      ls /hadoop-ha
  5. Update Hive Metastore NameNodes.
    1. Go to the Hive service.
    2. Select Actions > Update Hive Metastore NameNodes.
  6. If you have an Impala service, restart the Impala service or run an INVALIDATE METADATA query.
  7. Initialize JournalNode shared edits directory.
    1. Click Instances.
    2. Select the checkboxes next to the JournalNode role instances.
    3. Select Actions for Selected > Start.
    4. Click any NameNode, select Actions > Initialize Shared Edits Directory.
    5. ssh to JournalNode host to ensure that the JournalNode data directory has the new nameservice folder generated.
  8. Start other HDFS roles.
    1. Click the Instance tab, select the checkboxes next to all the HDFS role instances except for datanodes.
    2. Select Actions for Selected > Start.
      You can see both NameNodes web UIs show Active and Standby, also nameservice names are updated. However both NameNodes are in safemode waiting for DN to startup and send block reports.
    3. Click Instances, start all the DN roles, wait for both NN to exit safemode automatically.
  9. Redeploy client configuration files.
  10. Start all services except ZooKeeper.
  11. For clusters having Ranger service, change the references to new nameservice name, if any.
    1. Go to Ranger Admin Web UI, click cm_hdfs, check available policies and change the references to new nameservice name on HDFS path, if any.
    2. On Ranger Admin Web UI, click cm_hive, check available policies and change the references to new nameservice name on Impala URI, if any.