序言:我是hadoop/hive的新手。已經安裝了獨立的hadoop,現在正試圖讓蜂巢工作。我不斷收到有關初始化Metastore的錯誤,似乎無法弄清楚如何解決。 (2.7.2 Hadoop的蜂房和2.0)Hadoop Metastore不會初始化
HADOOP_HOME AND HIVE_HOME設置
ubuntu15-laptop: ~ $>echo $HADOOP_HOME
/usr/hadoop/hadoop-2.7.2
ubuntu15-laptop: ~ $>echo $HIVE_HOME
/usr/hive
HDFS正在
ubuntu15-laptop: ~ $>hadoop fs -ls/
Found 2 items
drwxrwxr-x - testuser supergroup 0 2016-04-13 21:37 /tmp
drwxrwxr-x - testuser supergroup 0 2016-04-13 21:38 /user
ubuntu15-laptop: ~ $>hadoop fs -ls /user
Found 1 items
drwxrwxr-x - testuser supergroup 0 2016-04-13 21:38 /user/hive
ubuntu15-laptop: ~ $>hadoop fs -ls /user/hive
Found 1 items
drwxrwxr-x - testuser supergroup 0 2016-04-13 21:38 /user/hive/warehouse
ubuntu15-laptop: ~ $>groups
testuser adm cdrom sudo dip plugdev lpadmin sambashare
蜂房不工作。說我需要初始化我metastore
ubuntu15-laptop: ~ $>hive
Logging initialized using configuration in
jar:file:/usr/hive/lib/hive-common-2.0.0.jar!/hive-log4j2.properties
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)
,所以我嘗試初始化它的Postgres期運用 - 但schematool嘗試使用derby
ubuntu15-laptop: ~ $>schematool -initSchema -dbType postgres
Metastore connection URL: jdbc:derby:;databaseName=metastore_db;create=true
Metastore Connection Driver : org.apache.derby.jdbc.EmbeddedDriver
Metastore connection User: APP
Starting metastore schema initialization to 2.0.0
Initialization script hive-schema-2.0.0.postgres.sql
Error: Syntax error: Encountered "statement_timeout" at line 1, column 5.
(state=42X01,code=30000)
org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization
FAILED! Metastore state would be inconsistent !!
*** schemaTool failed ***
,所以我改變蜂房的site.xml使用Postgres的驅動程序等但因爲我不 安裝驅動程序,它失敗
ubuntu15-laptop: ~ $>cp /usr/hive/conf/hive-site.xml.templ /usr/hive/conf/hive-site.xml
ubuntu15-laptop: ~ $>schematool -initSchema -dbType postgres
Metastore connection URL: jdbc:postgresql://localhost:5432/hivedb
Metastore Connection Driver : org.postgresql.Driver
Metastore connection User: 123456
org.apache.hadoop.hive.metastore.HiveMetaException: Failed to load driver
*** schemaTool failed ***
於是我嘗試用德比 首先移動蜂巢-site.xml中出的T他的方式再這樣默認是德比
ubuntu15-laptop: ~ $>mv /usr/hive/conf/hive-site.xml /usr/hive/conf/hive-site.xml.templ
然後我嘗試用德比再次intializing但它似乎已經 每個錯誤初始化「錯誤:函數‘NUCLEUS_ASCII’已經存在」
ubuntu15-laptop: ~ $>schematool -initSchema -dbType derby
Metastore connection URL: jdbc:derby:;databaseName=metastore_db;create=true
Metastore Connection Driver : org.apache.derby.jdbc.EmbeddedDriver
Metastore connection User: APP
Starting metastore schema initialization to 2.0.0
Initialization script hive-schema-2.0.0.derby.sql
Error: FUNCTION 'NUCLEUS_ASCII' already exists. (state=X0Y68,code=30000)
org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization
FAILED! Metastore state would be inconsistent !!
*** schemaTool failed ***
我我已經在這裏呆了兩天了。任何幫助將非常感激。
此外,如果您對hive-site.xml中的javax.jdo.option.ConnectionURL進行了更改,metastore_db將顯示在您指定的目錄中,而不是$ HIVE_HOME中。 – midtownguru
Rebecca,你已經提出了postgresql的問題,但在回答中似乎你已經得到了德比的安慰。有了postgresql,你可以使用schematool嗎? –
這是解決此問題的好方法。在我的Mac 10.12.2中,我通過brew安裝配置單元,遇到了很多問題。 mv metastore_db metastore_db.tmp; schematool -initSchema -dbType derby; hive;是一個很好的解決方法 – Windyground