in Hadoopery

Like many environments, we run a few long-lived Hadoop clusters in our lab for doing testing of various feature and functionality scenarios before they are placed in a production context. These are used as big sandboxes for our team to play with and do development upon. Today, we encountered a strange Hive Metastore error on one environment that we had not previously run across: table creations would throw RPC errors from both Hive and Impala.

The Cluster: A Background

In this particular cluster, we utilize Cloudera Manager 5.10 to maintain a very straight forward CDH installation. It has Impala, Hive, YARN, Kudu, and a few other things to support the handful of engineers using it as a sandbox. Because this is a test environment, we don’t run it in High Availability mode, nor do we have security enabled (although, we do have other testing environments for those features).

Simple enough.

The Cluster: A history of names

At some point in the last six months, we underwent a change in how we manage clusters, necessitating a redesign of the DNS architecture to make it easier to allow different groups to self-service their DNS hostname creation requests. As part of this effort, we had to walk through all of our clusters changing hostnames to reference the new, correct subdomain for each cluster. We went from having a general subdomain where everything lived (i.e. to having cluster subdomains named by cluster (i.e., This is usually a straight forward process and Cloudera provides good documentation to walk you through renaming hosts.

The Error

ImpalaRuntimeException: Error making 'createTable' RPC to Hive Metastore: 
   CAUSED BY: MetaException: java.lang.IllegalArgumentException: should be cdhhive, 

The error implied an obvious (to us) issue: a configuration file somewhere must have the wrong hostname still listed from our attempts earlier in the year to rename the cluster nodes. Unfortunately, looking through all the configuration options for Hive, Impala, and various other components controlled by Cloudera Manager led us to believe that none of the properties were mis-configured. So what was it?

Further down the debug hole

Isolating the configurations leads us down a few paths:

  1. The client configurations in use by the user may be wrong.
  2. The old DNS configuration is cached somewhere, such as in running daemons.
  3. The old DNS configuration is still referenced somewhere outside of Cloudera Manager and CDH, such as in the host’s /etc directory.
  4. The old DNS configuration is still referenced within the Impala statestore.
  5. The old DNS configuration is still referenced within the Hive Metastore.

Wrong client configuration?

The first thought was that the user had a locally cached set of client configurations referenced by beeline, hive, or impala-shell. This was easily dispelled: the user was working with impala-shell, which connects to a specific daemon. Additionally, we verified that all nodes on the cluster were showing the latest client configurations both in CM as well as on the nodes themselves.

Strike out, the first.

Wrongly cached DNS in running daemons?

We had done the host renames months back and all of us were sure that the cluster had been restarted multiple times since then. Just to rule it out, we shut down the cluster and started fresh to make sure none of the daemons had run from before the rename. This changed nothing.

Strike out, number two.

Wrongly referenced DNS names in /etc?

We thought that an OS-level file in /etc (such as /etc/hosts) may be confusing things on either the edge node we ran impala-shell from, the node running Hive Metastore, or the node running the Impala daemon we were connecting to. We ruled these out by validating all the files in /etc referenced the correct names, as well as trying to run the impala-shell from various hosts and to various Impala daemons. All hosts showed the same behavior.

Strike out, number three.

Wrongly cached DNS in Impala statestore?

This was a stretch. The statestore should only care about what’s now running on the cluster. Restarting the entire cluster, including all Impala daemons would have reset this.

Strike out, number four.

Wrongly referenced DNS in Hive Metastore?

Here is where it got interesting.

The easiest way to check for old host names in the Metastore would be to dump the database and look through it. We use PostgreSQL for the database backend, so it would be a simple matter of running pg_dump. Because we only run the “embedded” instance within Cloudera Manager in our sandboxes, we will need to run this from the Cloudera Manager node.

$ pg_dump -h localhost -p 7432 -U hive -a hive | grep -c

Bingo! We had 220 references to the old hostnames somewhere within the database in one or more tables. Digging around in the Hive Metastore dump, it appeared that we had references in three different tables: TABLE_PARAMS, DBS, and SDS.

Examples from each table:


This table defines different parameters for the table.

hive=> select * from "TABLE_PARAMS" where "PARAM_VALUE" similar to '';
 26003 | avro.schema.url | hdfs://


This table defines the locations of the tables (and possibly various partitions).

hive=> select "SD_ID", "LOCATION" from "SDS" where "LOCATION" similar TO '';
 18480 | hdfs://


This table defines the location to the database directory.

hive=> select "DB_ID", "DB_LOCATION_URI" from "DBS" where "DB_LOCATION_URI" similar TO '';
 1 | hdfs://

Ok, now what?

Now that we have an idea of what’s going on, how do we fix it? Well, reading through the documentation for host renames, we saw that there’s a step called “Update Hive Metastore Namenodes“. This is supposed to be run in the event that the nodes you’re renaming include the NameNodes for the cluster. We weren’t sure if this was run, so we attempted to do it again. This step requires that the cluster be completely disabled and turned off before Cloudera Manager will enable the option.

In theory, this command will run through the Hive Metastore and update all references of the old NameNode name to the current one (i.e. to

Running it showed success.

Cloudera Manager Update Hive Metastore Namenodes command

Output of Cloudera Manager’s “Update Hive Metastore Namenodes” command.

Great! Or so we thought. Attempts to re-issue the table creation continued to fail with the same error and looking through the database showed that the names in the HDFS paths were not getting updated.

A deeper look at the logs showed something curious: the wrong name was picked up for part of the work, so it only attempted to set the new hostname on entries that already used the new hostname for the NameNode.

Updating Hive Metastore to use location hdfs://
List FS Root output:
Initializing HiveMetaTool.. Listing FS Roots..
Old FS Root: hdfs://

And when we look further down the log where it updates the individual tables, we see that it only touches entries that had already used the correct host name.

Initializing HiveMetaTool..
Looking for LOCATION_URI field in DBS table to update..
Successfully updated the following locations..
old location: hdfs:// 
  new location: hdfs://
Updated 3 records in DBS table

Super bizarre. So what to do?

The Hive Metastore Fix is In!

Our next option was to update the database entries by hand. But, because there were hundreds of entries, we didn’t want to update each row-by-row. A little googling and testing brought us the following three SQL statements that we ran, which allowed us to update all references correctly. Note: there may be other tables in your environment! This was an exhaustive fix for our environment, but YMMV.

update "TABLE_PARAMS" set "PARAM_VALUE" = replace ("PARAM_VALUE", '', '') ; 
update "DBS" set "DB_LOCATION_URI" = replace("DB_LOCATION_URI", '','') ;
update "SDS" set "LOCATION" = replace("LOCATION", '','') ;

Once this was done, we fired up Hive and Impala on the cluster and tested our table creation: success! The new table was created.

The Aftermath

Thinking through this, we’re still not sure how this could have occurred (other than a possible bug in Cloudera Manager). My best theory is that Hive and Impala managed to stay up and running through the host renames, allowing this weird condition to occur where old references to the hostnames worked because the hostname and IP address were cached. We had entries in the various location columns that referenced both the old and new addresses. At some point, the Hive Metastore may have crashed or been restarted, causing the problem to arise.

Funny enough, if we had enabled High Availability, I’m reasonably sure this problem would never have occurred because the various HDFS paths would have been stored using the HDFS High Availability name service name and not the real name of the NameNode.

Travis Campbell
Staff Systems Engineer at ghostar
Travis Campbell is a seasoned Linux Systems Engineer with nearly two decades of experience, ranging from dozens to tens of thousands of systems in the semiconductor industry, higher education, and high volume sites on the web. His current focus is on High Performance Computing, Big Data environments, and large scale web architectures.