2
votes

I have installed Hive, added it to PATH and am able to open it using the hive command in Terminal.

However, when I attempt to run a basic command such as

SHOW TABLES;

I am presented with the error:

FAILED: SemanticException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient

The instructions I am following do not suggest that anything has to be instantiated.

For reference, I am using the book Hadoop: The Definitive Guide (4th Edition) and running it locally on my machine.

When running JPS the following services are running:

2528 DataNode 7232 RunJar 2441 NameNode 7401 Jps 2634 SecondaryNameNode 282 2842 NodeManager 2751 ResourceManager

2

2 Answers

3
votes

I fixed by removing the derby database files

rm -rf $HIVE_HOME/bin/metastore_db 

and

$HIVE_HOME/bin/schematool -initSchema -dbType derby
2
votes

I was able to resolve this problem by initializing the schema. I am surprised it is not mentioned anywhere.

To initialize the schema:

  1. Navigate to your Hive installation folder
  2. [install folder]/bin/schematool -initSchema -dbType derby
  3. Next you should receive some messages confirming

    Metastore Connection Driver : org.apache.derby.jdbc.EmbeddedDriver Metastore connection User: APP Starting metastore schema initialization to 2.3.0 Initialization script hive-schema-2.3.0.derby.sql Initialization script completed schemaTool completed

  4. Start hive

  5. Run any basic commands to determine Hive is functioning such as SHOW TABLES;