天天看點

配置hive的常見出錯總結

1. Hive metastore database is not initialized.

Exception in thread "main" java.lang.RuntimeException: Hive metastore database is not initialized. Please use schematool (e.g. ./schematool -initSchema -dbType ...) to create the schema. If needed, don't forget to include the option to auto-create the underlying database in your JDBC connection string (e.g. ?createDatabaseIfNotExist=true for mysql)

報錯解決:

在hive的bin目錄下執行:./schematool -dbType mysql -initSchema

2.Exception in thread "main" java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D

解決方案如下:

1.檢視hive-site.xml配置,會看到配置值含有"system:java.io.tmpdir"的配置項

2.在hive目錄下建立檔案夾iotmp

3.将含有"system:java.io.tmpdir"的配置項的值修改為如上位址

啟動hive,成功!

3.The specified datastore driver ("com.mysql.jdbc.Driver") was not found in the CLASSPATH

解決方法:

将将mysql-connector-java-5.1.37/mysql-connector-java-5.1.37-bin.jar放在$HIVE_HOME/lib

注意:mysql-connector-java-version-bin.jar的version(版本)不能太低,我試過5.1.7 版本,即使把jar放在lib下也會報錯

繼續閱讀