Backgroud:
- CentOS7
- hadoop-2.7.3
- spark-2.0.1-bin-hadoop2.7
- apache-hive-2.1.0-bin (only used to start metastore service by hive --service metastore)
- Have HADOOP_HOME, SPARK_HOME and HIVE_HOME etc. configured
- mysql 5.7.16
- Have put mysql-connector-java-5.1.40-bin.jar into both hive/lib/ and spark/jars/
hive-site.xml:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://www.test.com:3306/metastore</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hive</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>password</value>
</property>
<property>
<name>hive.metastore.uris</name>
<value>thrift://www.test.com:9083</value>
</property>
<property>
<name>hive.metastore.schema.verification</name>
<value>true</value>
</property>
</configuration>
I put hive-site.xml into both hive/conf/ and spark/conf/
But run start-thriftserver.sh, I got error logs (in spark_home/logs/spark--HiveThriftServer2.out):
......
INFO HiveUtils: Initializing HiveMetastoreConnection version 1.2.1 using Spark classes.
INFO metastore: Trying to connect to metastore with URI thrift://www.test.com:9083
INFO metastore: Connected to metastore.
......
DEBUG ObjectStore: Overriding javax.jdo.option.ConnectionURL value null from jpox.properties with jdbc:derby:memory:;databaseName=/tmp/spark-37dcab7f-655a-4506-abd7-492a8620a33e/metastore;create=true
......
INFO MetaStoreDirectSql: Using direct SQL, underlying DB is DERBY
......
org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
In log we can see property "hive.metastore.uris" did work.
But seems other mysql relative properties didn't work, metastore still use the default database derby.
Any help appreciated! Thanks.
Resolved:
I Removed hive.metastore.uris because I just used hive locally.
<property>
<name>hive.metastore.uris</name>
<value>thrift://www.test.com:9083</value>
</property>
Set hive.metasotre.schema.verification to false. Thanks for Nirmal's help.