Changing Hostnames

After you have installed Cloudera Manager and created a cluster, you may need to update the names or IP addresses of the hosts running the Cloudera Manager Server or cluster services. To update a deployment with new hostnames or IP addresses, follow these steps:
  Important: The process described here requires Cloudera Manager and cluster downtime.
  1. Verify if SSL/TLS certificates have been issued for any of the services and make sure to create new SSL/TLS certificates in advance for services protected by TLS/SSL. Review Cloudera Manager and CDH documentation at Cloudera Documentation.
      Tip: Search for SSL and TLS in the documentation.
  2. Make a backup of your Cloudera Manager database using mysqldump, pg_dump, or another preferred backup utility. Store the backup in a safe location.
  3. Export your Cloudera Manager configuration using one of the following methods:
    • Open your browser and type this URL http://cm_hostname:7180/api/v4/cm/deployment
    • From terminal type:

      $ curl -u admin:admin http://cm_hostname:7180/api/v4/cm/deployment > cme-cm-export.json

      If Cloudera Manager SSL is in use, specify the -k switch:

      $ curl -k -u admin:admin http://cm_hostname:7180/api/v4/cm/deployment > cme-cm-export.json

    Ensure that you are using the correct version of the API for the version of Cloudera Manager you are using. The version is a part of the URL and comes after /api/ (v3, v4, or v5).

  4. Stop all services on the cluster.
  5. Stop the Cloudera management service.
  6. Stop the Cloudera Manager Server.
  7. Stop the Cloudera Manager Agents on the hosts that will be having the hostname changed.
  8. Update the Cloudera Manager database:
    1. Update the target hosts using standard per-OS/name service methods (/etc/hosts, dns, /etc/sysconfig/network, hostname, and so on). Ensure that you remove the old hostname.
    2. Login to database client for the Cloudera Manager database and perform the following commands:
      • PostgreSQL
        1. Log into the Cloudera Manager database: psql -U scm -p7432
        2. Run the command: postgres> select HOST_ID, HOST_IDENTIFIER, NAME from HOSTS; In the results, note the HOST_ID in the first column. This will be $the_specific_host_rowID in the next step for each of the hosts you are modifying.
        3. For the hosts you're modifying run the command: postgres> update HOSTS set HOST_IDENTIFIER = 'new.host.name.FQDN' where HOST_ID = $that_hosts_row_ID;
      • MySQL
        1. Log into the Cloudera Manager database:
          mysql -h localhost -u scm -p 
          mysql> use cm;
        2. Run the command: mysql> select HOST_ID, HOST_IDENTIFIER, NAME from HOSTS; In the results, note the host_id in the first column. This will be $the_specific_host_rowID in the next step for each of the hosts you are modifying.
        3. For the hosts you're modifying run the command: mysql> update HOSTS set HOST_IDENTIFIER = 'new.host.name.FQDN' where HOST_ID = $the_specific_host_rowID;
        Note: The name column will be updated when the Agent starts heartbeating.
    3. If you are changing the hostname of the host running Cloudera Manager Server do the following:
      1. Change the hostname as per step 2.
      2. Update the Cloudera Manager hostname in /etc/cloudera-scm-agent/config.ini on all Agents.
    4. If the cluster is configured for Kerberos security, do the following:
      1. In the Cloudera Manager database, set the merged_keytab value:
        • PostgreSQL
          update roles set merged_keytab=NULL;
        • MySQL
          update ROLES set MERGED_KEYTAB=NULL;
      2. Remove old hostname cluster service principals from the KDC database using one of the following:
        • Use the delprinc command within kadmin.local interactive shell.
        • From the command line:
          kadmin.local -q "listprincs" | grep -E "(HTTP|hbase|hdfs|hive|httpfs|hue|impala|mapred|solr|oozie|yarn|zookeeper)[^/]*/ [^/]@" > cluster-princ.txt

          Open cluster-princ.txt and remove any non-cluster service principal entries within it. Make sure that the default krbtgt and other principals you created, or were created by Kerberos by default, are not removed by running the following: for i in `cat cluster-princ.txt`; do yes yes | kadmin.local -q "delprinc $i"; done.

      3. Within the Cloudera Manager Admin Console recreate all the principals based on the new hostnames:
        1. Select Administration > Kerberos.
        2. Do one of the following:
          • If there are no principals listed, click the Generate Principals button.
          • If there are principals listed, click the top checkbox to select all principals and click the Regenerate button.
  9. Start the Cloudera Manager database and Server.
  10. Start the Agents on the newly renamed hosts. The Agents should show a current heartbeat in Cloudera Manager.
  11. If NameNode High Availability Automatic Failover is enabled, reconfigure the ZooKeeper failover controller znodes to reflect the new hostname.
      Warning:
    • Do not perform this step if you are also running JobTracker in a High Availability configuration, as clearing the hadoop-ha znode will negatively impact JobTracker HA.
    • All other services, and most importantly HDFS, should not be running.
    1. Start ZooKeeper services in the Cloudera Manager Admin Console.
        Note: Make sure the ZooKeeper Failover Controller role is stopped within the HDFS service; start only the ZooKeeper Server role instances.
    2. On one of the hosts that has a ZooKeeper Server role, log into the Zookeeper CLI to delete the nameservice znode:
      • On an package-based installation zkCli.sh is found at: /usr/lib/zookeeper/bin/zkCli.sh
      • On a parcel-based installation zkCli.sh is found at: $/opt/cloudera/parcels/CDH/lib/zookeeper/bin/zkCli.sh
      1. Verify that the HA znode exists: zkCli$ ls /hadoop-ha
      2. Delete the old znode: zkCli$ rmr /hadoop-ha/nameservice1
    3. In the Cloudera Manager Admin Console, go to the HDFS service.
    4. Click the Instances tab.
    5. Select Actions > Initialize High Availability State in ZooKeeper....
  12. For each of the Cloudera Management service roles (Host Monitor, Service Monitor, Reports Manager, Activity Monitor, Navigator) go to their configuration and update the Database Hostname property.
  13. Start all cluster services.
  14. Start the Cloudera management service.