Upgrade Ranger and HMS schema after Data Lake restore

When Data Lake is restored using a backup that was taken from an older version of Runtime, Ranger and HMS schema may need to be upgraded manually. This is only needed for certain Runtime versions, as specified in Cross-version support for Data Lake backup and restore.

A Data Lake administrator should perform the below steps after the restore is complete. The steps need to be performed in Data Lake’s Cloudera Manager.

Steps

  1. SSH into the host where the Data Lake Cloudera Manager is running:
    ssh -i ~/.ssh/<PRIVATE_KEY_NAME>.pem cloudbreak@<HOSTNAME>
    • Replace the <PRIVATE_KEY_NAME> with the PEM key name that you provided during environment registration.
    • Replace the <HOSTNAME> with the hostname or IP address of a Data Lake node.
  2. Obtain Cloudera Manager user’s DB name, user name, and password:
    sudo cat /etc/cloudera-scm-server/db.properties

    Copy the output. You will need it in later steps.

  3. Connect to the backend database:
    psql -U <USERNAME> -p <PASSWORD> -h <DB_HOST> -d clouderamanager
    • Replace the <USERNAME>, <PASSWORD> and <DB_HOST> with the actual database host name obtained earlier.
  4. Grant your CSSO user performing schema upgrade the “ROLE_ADMIN” Cloudera Manager role by running the below command:
    INSERT INTO user_auth_roles SELECT user_id, auth_role_id 
    FROM users, auth_roles 
    WHERE users.user_name='<CSSO_USER_PERFORMING_RESTORE>' AND 
    auth_roles.name='ROLE_ADMIN';
    • Replace the <CSSO_USER_PERFORMING_RESTORE> with your CSSO user name.
  5. Restart Cloudera Manager:
    service cloudera-scm-server restart
  6. Remove the BROWSER cookies. In the Chrome browser, you can do this in: Settings → Privacy and security → Clear browsing data → Check “Cookies and other side data” → Clear data.
  7. Re-login to Cloudera Manager.
  8. Upgrade HMS schema by clicking on Hive Metastore → Actions → Validate Hive Metastore Schema. If the validation succeeds, move to step 9. If the validation fails, you need to first upgrade the schema by following these steps:
    1. Stop Hive Metastore.
    2. Click on Hive Metastore → Actions → Upgrade Hive Metastore Database Schema
    3. If you now run the validation again, it should pass.
    4. Start Hive Metastore.
  9. Upgrade Ranger schema:
    1. Stop Ranger.
    2. Click on Ranger → Actions → Upgrade Ranger Database and apply patches
    3. Start Ranger.