hadoop - Hive 安装问题 : Hive metastore database is not initialized

标签 hadoop installation hive derby

我尝试在树莓派 2 上安装 Hive。我通过解压缩压缩的 Hive 包安装 Hive,并在我创建的 hduser 用户组下手动配置 $HADOOP_HOME 和 $HIVE_HOME。运行配置单元时,我收到以下错误消息: 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)

所以我运行了上面错误消息中建议的命令: schematool -dbType derby -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 如何与 Derby 一起工作的帮助或任何解释都将不胜感激!

最佳答案

安装 hive 后,如果您做的第一件事是运行 hive,则 hive 会尝试创建/初始化 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)

运行 hive,即使失败,也会在运行 hive 的目录中创建一个 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 已经存在,但形式不完整。

太棒了,答案是:

  1. 在第一次运行 hive 之前,运行

    schematool -initSchema -dbType derby

  2. 如果您已经运行了 hive,然后尝试 initSchema 但它失败了:

    mv metastore_db metastore_db.tmp

  3. 重新运行

    schematool -initSchema -dbType derby

  4. 再次运行hive

**另请注意:如果您更改目录,将找不到上面创建的 metastore_db!我敢肯定这是有充分理由的,我还不知道,因为我今天真的是第一次尝试使用配置单元。啊这里有关于此的信息:无论我运行 Hive 在哪里都创建了 metastore_db

关于hadoop - Hive 安装问题 : Hive metastore database is not initialized,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35655306/

相关文章:

java - 使用 hadoop 错误设置获取 JAVA_HOME

Hadoop 和 HBase

hadoop - 无法使用 Hive 版本 1.1.0 HBase 版本 0.94.8 和 hadoop 版本 2.7.0 从配置单元创建 Hbase 表

java - 检测到 Sqoop 套接字超时 : Read timed out while reading data from Mainframe and insert into Hive

hadoop - 如何从不同主机外部访问在docker容器(覆盖)中运行的服务

hadoop - 尝试从Hadoop URL读取数据,但无法读取错误信息

java - 如果已安装,则无法重新运行 Java JPackage 安装程序,第二次将在没有警告的情况下退出

installation - 在 Windows 8 上安装时如何防止应用程序出现在 Metro 上?

wcf - Wix安装程序: Verify that you have sufficient privileges to start system services

java - Spark Java API、Kerberos 和 Hive 的问题