我用的hadoop 是2.6.0 版本 ,hive 是 2.1.1版本
進入;/home/zkpk/apache-hive-2.1.1-bin/
執行hive 后報錯:
(1)Exception in thread "main" java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException:
java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
MetaException(message:Version information not found in metastore. )
Caused by: java.lang.RuntimeException: Unable to instantiate
org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
分析:需要在hive中首先啟動 metastore:
使用:
apache-hive-2.1.1-bin/bin/hive --service metastore &
(2)然后報錯:
message:Version information not found in metastore.
分析 在hive配置中吧schema設置為不驗證:
message:Version information not found in metastore. )”
修改conf/hive-site.xml 中的 “hive.metastore.schema.verification” 值為 false 即可解決 “Caused by: MetaException
(message:Version information not found in metastore. )”
<property>
<name>hive.metastore.schema.verification</name>
<value>false</value>
<description>
Enforce metastore schema version consistency.
True: Verify that version information stored in metastore matches with one from Hive jars. Also disable automatic
schema migration attempt. Users are required to manully migrate schema after Hive upgrade which ensures
proper metastore schema migration. (Default)
False: Warn if the version information stored in metastore doesn't match with one from in Hive jars.
</description>
</property>
3 執行hive.繼續報錯誤:
MetaException(message: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))
分析: 需要 使用 schematool工具初始化hive的 元素:
# 進入指定的目錄
cd apache-hive-2.1.1-bin/bin/
# 初始化,如果是mysql則derby可以直接替換成mysql
./schematool -initSchema -dbType mysql
然后執行:[root@master bin]# hive
報錯:: Permission denied: user=root, access=EXECUTE, inode="/tmp":zkpk:supergroup:drwx------
at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkFsPermission(FSPermissionChecker.java:271)
分析:
我一直用zkpk用戶部署hive,看來是權限不對
切換賬戶:
su zkpk
執行::/home/zkpk/apache-hive-2.1.1-bin/bin/hive 正常啟動:
hive> show tables;
OK
Time taken: 1.993 seconds
hive>
搞定;