Hive Metastore is not creating MYSQL or Derby Connection

丶灬走出姿态 提交于 2019-12-08 05:48:40

问题


Hive Metastore is not creating MYSQL or Derby Connection.

For Derby

schematool -dbType derby -initSchema
Metastore connection URL:    jdbc:mysql://localhost/metastore
Metastore Connection Driver :    com.mysql.jdbc.Driver
Metastore connection User:   hive

schematool -dbType derby -info
Metastore connection URL:    jdbc:mysql://localhost/metastore
Metastore Connection Driver :    com.mysql.jdbc.Driver
Metastore connection User:   hive
org.apache.hadoop.hive.metastore.HiveMetaException: Failed to load driver
*** schemaTool failed ***

For mysql

schematool -dbType mysql -initSchema
Metastore connection URL:    jdbc:mysql://localhost/metastore
Metastore Connection Driver :    com.mysql.jdbc.Driver
Metastore connection User:   hive
org.apache.hadoop.hive.metastore.HiveMetaException: Failed to load driver
*** schemaTool failed ***

schematool -dbType mysql -info
Metastore connection URL:    jdbc:mysql://localhost/metastore
Metastore Connection Driver :    com.mysql.jdbc.Driver
Metastore connection User:   hive
org.apache.hadoop.hive.metastore.HiveMetaException: Failed to load driver
*** schemaTool failed ***

What is the issue .

I am running Hive 0.12.0


回答1:


I think the problem is with your URL. Modify the URL as follows. Put the mysql port no.

Metastore connection URL: jdbc:mysql://localhost:3306/metastore




回答2:


If you want to access Derby, I suspect these should be something like:

Metastore connection URL:    jdbc:derby://localhost:1527/metastore
Metastore Connection Driver :    org.apache.derby.jdbc.ClientDriver

instead of

Metastore connection URL:    jdbc:mysql://localhost/metastore
Metastore Connection Driver :    com.mysql.jdbc.Driver



回答3:


For this specific error "Failed to load driver", you should check if you have the mysql connector copied or has a link in Hive lib folder.

ln -s /usr/share/java/mysql-connector-java.jar $HIVE_HOME/lib/mysql-connector-java.jar

(Download it if you don't have it within the Java libs)

Similarly get the lib for Derby too.




回答4:


The error message is very broad. To get more information on the root cause, schematool supports the -verbose flag:

schematool -dbType derby -initSchema -verbose

This will print the full stacktrace, which in my case indentified the missing database:

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'metastore'



来源:https://stackoverflow.com/questions/21451622/hive-metastore-is-not-creating-mysql-or-derby-connection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!