2016-02-26 330 views
25

我试图在树莓派2上安装配置单元。我通过解压缩压缩的Hive包安装了Hive,并在我创建的hduser用户组下手动配置了$ HADOOP_HOME和$ HIVE_HOME。当运行蜂巢,我得到了以下错误消息: 蜂巢Hive安装问题:Hive Metastore数据库未初始化

ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.

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)

于是我就命令在上面的错误信息提示: schematool -dbType德比-initSchema 我得到的错误信息:

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如何与德比合作的任何帮助或任何解释,我们将不胜感激!

+0

你有没有想过解决这个问题? – Newtopian

回答

9

我遇到过类似的问题,这是我固定通过删除Derby数据库文件rm -Rf $HIVE_HOME/metastore_db

要知道,这将完全删除您的架构!

清理旧模式后,我可以重新初始化有:

$HIVE_HOME/bin/schematool -initSchema -dbType derby 

它可能从那里你叫蜂巢不同,尝试去到您的蜂巢的安装目录,然后运行./bin/hive

+0

你有没有其他建议我试过这个并得到相同的模式工具失败的错误,如上 – Ronan

+0

在我的情况下,数据库是mysql.Thank你这么多 –

91

安装配置单元后,如果您所做的第一件事是运行配置单元,配置单元尝试创建/初始化metastore_db,但显然可能无法正确执行。对初次运行,也许你看到你的错误:

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) 

运行蜂巢,即使失败了,创造了从中运行蜂巢的目录metastore_db目录:

ubuntu15-laptop: ~ $>ls -l |grep meta 
drwxrwxr-x 5 testuser testuser 4096 Apr 14 12:44 metastore_db 

所以,当你再试运行

ubuntu15-laptop: ~ $>schematool -initSchema -dbType derby 

Metastore已经存在,但不是完整的形式。

Soooooo答案是:

  1. 在运行首次蜂巢,运行

    schematool -initSchema -dbType德比

  2. 如果您已经运行蜂巢,然后试着initSchema并且失败:

    mv metastore_db metastore_db。TMP

  3. 重新运行

    schematool -initSchema -dbType德比

  4. 运行蜂巢再次

**另外值得注意的:如果你更改目录中,metastore_db上述亿韩元创造”找不到!我确信有一个很好的理由,我还不知道,因为我今天真的第一次尝试使用蜂巢。唉唉这里的一对这样的信息:metastore_db创建的地方我跑蜂巢

+1

thnx!这节省了很多时间。 –

+1

谢谢你救了我 – Suresh

+1

谢谢ssso多!! –

9

我安装蜂箱与自制(MacOS的)位于/ usr /本地/库/蜂巢和AFER运行 schematool -dbType derby -initSchema我收到以下错误信息:

启动将Metastore架构初始化为2.0.0 初始化脚本hive-schema-2.0.0.derby.sql 错误:FUNCTION'NUCLEUS_ASCII'已经存在。 (state = X0Y68,code = 30000) org.apache.hadoop.hive.metastore.HiveMetaException:模式初始化失败! Metastore状态将不一致!

但是,我找不到你的安装路径或者metastore_db或metastore_db.tmp文件夹,所以我尝试:

  1. find /usr/ -name hive-schema-2.0.0.derby.sql
  2. vi /usr/local/Cellar/hive/2.0.1/libexec/scripts/metastore/upgrade/derby/hive-schema-2.0.0.derby.sql
  3. 注释 'NUCLEUS_ASCII' 功能和 'NUCLEUS_MATCHES'功能
  4. rerun schematool -dbType derby -initSchema,那么一切顺利!

希望这有助于某人。

+0

这是一个很好的答案。如何使用它来我的问题在这里:http://stackoverflow.com/questions/43947930/unable-to-initialize-hive-with-derby-from-brew-install – javadba

+0

这是一个伟大的!节省了时间 – Ankita