After enabling HA for HDFS, Cloudera Manager has a feature to allow you to perform an update to existing HMS database, so that all the references to the old HDFS URL is updated to use the new nameservice name:
You can only do it after Hive service is stopped.
However, there is a hard limit of 150 seconds for this command to run in Cloudera Manager, once it is reached, an error will be returned.
"Command aborted because of exception: Command timed-out after 150 seconds"
There is already a JIRA to get this limit removed, however, it won’t happen until Cloudera Manager 5.5.
To solve this problem, we can manually run the Hive metatool from the command line, follow the steps below:
1) Test the metatool to verify that it is working from command line on the Hive gateway host:
hive --service metatool -listFSRoot
2) Run Hive Metatool to update the nameservice:
hive --service metatool -updateLocation hdfs://nameservice1 hdfs://oldnamenode.com -tablePropKey avro.schema.url
If you getting errors like SQL driver not found or not able to connect to HMS database, please add the following steps and try above again on the HMS host:
3) Locate the HMS run time configuration directory on the HMS host, /var/run/cloudera-scm-agent/process/
4) Determine which DB type you are using, MySQL, PostgeSQL or Orcale, in my below example I used PostgeSQL
Then just wait for the command to finish and then restart Hive Services. So long as there is no other errors, you are good to go.