0
votes

I have installed hadoop, hive and MySQL on the same server in CENT OS. I have also setup MySQL and user ID - hive has access to the database by using the following steps.

mysql> CREATE DATABASE metastore;
mysql> USE metastore;

mysql> SOURCE $HIVE_HOME/scripts/metastore/upgrade/mysql/hive-schema-0.10.0.mysql.sql;

mysql> CREATE USER 'hiveuser'@'%' IDENTIFIED BY 'hivepassword'; 

mysql> GRANT all on *.* to 'hiveuser'@localhost identified by 'hivepassword';

mysql>  flush privileges;

My Hive-site.xml file properties are below:

<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost/metastorecreateDatabaseIfNotExist=true</value>
<description>metadata is stored in a MySQL server</description>
</property>

<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
<description>MySQL JDBC driver class</description>
</property>

<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hiveuser</value>
<description>user name for connecting to mysql server</description>      
</property>

<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>hivepassword</value>
<description>password for connecting to mysql server</description>
</property>

<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
<description> warehouse </description>
</property>

When I give the show tables command inside the hive shell I get the following error:

hive> show tables; FAILED: Error in metadata: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask

I searched all in the internet but couldn't find the solution for my problem. Can someone please guide me, what am I missing here ?

1
I think this question is more appropriate for dba.stackexchange.com.Gordon Linoff

1 Answers

0
votes
1. First just check your hadoop daemons. All are up or not.

2. Else restart your hadoop cluster once.

3. Have you copied the jar (mysql-connector-java.***) into Hive's lib dir?

4. Which mysql version you are using. If it is very old then :

   mysql>alter database metastore_Db character set latin1;

 I think step 1 and 2 will solve your problem.