Hive安装问题:Hive Metastore数据库未初始化 [英] Hive installation issues: Hive metastore database is not initialized

查看:5041
本文介绍了Hive安装问题:Hive Metastore数据库未初始化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在raspberry pi 2上安装配置单元。我通过解压缩压缩的Hive包安装了Hive,并在我创建的hduser用户组下配置了$ HADOOP_HOME和$ HIVE_HOME。运行配置单元时,出现以下错误消息:
配置单元


ERROR StatusLogger未找到log4j2配置文件。使用默认配置:仅向控制台记录错误。



线程main中的异常java.lang.RuntimeException:未初始化Hive Metastore数据库。请使用schematool(例如./schematool -initSchema -dbType ...)来创建模式。如果需要,不要忘记在JDBC连接字符串中包含自动创建底层数据库的选项(例如,createDatabaseIfNotExist = true for mysql)

因此,我运行了上面错误消息中提示的命令:
schematool -dbType derby -initSchema
我收到了错误消息:

< blockquote>

错误:FUNCTION'NUCLEUS_ASCII'已经存在。 (state = X0Y68,code = 30000)
org.apache.hadoop.hive.metastore.HiveMetaException:模式初始化失败! Metastore状态将不一致!
* schemaTool失败*


当我尝试时,似乎没有任何有用的信息谷歌此错误在线。任何关于Hive如何与Derby协同工作的帮助或解释都将不胜感激! 解决方案

安装配置单元之后,被运行配置单元,配置单元试图创建/初始化metastore_db,但显然可能不正确。在最初的运行中,也许你看到了你的错误:

 线程main中的异常java.lang.RuntimeException:Hive Metastore数据库未初始化。请使用schematool(例如./schematool -initSchema -dbType ...)来创建模式。如果需要,不要忘记在JDBC连接字符串中包含自动创建底层数据库的选项(例如,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. 在运行配置单元之前第一次运行
    $ b $ schematool -initSchema -dbType derby


  2. 如果您已经运行了配置单元并且然后尝试initSchema并且失败:

    metastore_db metastore_ db.tmp


  3. 重新运行

    schematool -initSchema -dbType derby


  4. 再次运行配置单元


**同样值得注意的是:如果你更改目录,上面创建的metastore_db将不会被发现!我确信有一个很好的理由,我还不知道,因为我今天真的第一次尝试使用蜂巢。 Ahhh这里有关于这个的信息:在我运行Hive的任何地方创建metastore_db

I tried to install hive on a raspberry pi 2. I installed Hive by uncompress zipped Hive package and configure $HADOOP_HOME and $HIVE_HOME manually under hduser user-group I created. When running hive, I got the following error message: hive

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)

So I ran the command suggested in the above error message: schematool -dbType derby -initSchema I got the error message:

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 *

It seems there aren't any helpful information when I try to google this error online. Any help or any explanation on how Hive works with Derby would be appreciated!

解决方案

After installing hive, if the first thing you did was run hive, hive attempted to create/initialize the metastore_db, but apparently might not get it right. On that initial run, maybe you saw your error:

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)

Running hive, even though it fails, creates a metastore_db directory in the directory from which you ran hive:

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

So when you then tried running

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

The metastore already existed, but not in complete form.

Soooooo the answer is:

  1. Before you run hive for the first time, run

    schematool -initSchema -dbType derby

  2. If you already ran hive and then tried to initSchema and it's failing:

    mv metastore_db metastore_db.tmp

  3. Re run

    schematool -initSchema -dbType derby

  4. Run hive again

**Also of note: if you change directories, the metastore_db created above won't be found! I'm sure there's a good reason for this that I don't know yet because I'm literally trying to use hive for the first time today. Ahhh here's information on this: metastore_db created wherever I run Hive

这篇关于Hive安装问题:Hive Metastore数据库未初始化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆