Since Hive
shell also shows only default
database, the Hive
metastore configuration can be checked.
To start with, you can log into the database having the metastore, and run this query that should list Hive
databases. Example query for MySQL
database is:
mysql> SELECT NAME, DB_LOCATION_URI FROM hive.DBS;
Then, you can verify and update hive-site.xml
as per below. The location of this file on CDH
is generally at /usr/lib/hive/conf/hive-site.xml
, and on HDP
is generally at /usr/hdp/current/hive-client/conf/hive-site.xml
.
The documentation reference for configuration of the metastore:
a) https://cwiki.apache.org/confluence/display/Hive/AdminManual+MetastoreAdmin#AdminManualMetastoreAdmin-RemoteMetastoreDatabase
b) (CDH) https://www.cloudera.com/documentation/enterprise/5-6-x/topics/cdh_ig_hive_metastore_configure.html (Refer to the section: 4. Configure the metastore service to communicate with the MySQL database)
Example configuration:
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost/hive?createDatabaseIfNotExist=true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hive</value>
</property>