我尝试在树莓派 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 已经存在,但形式不完整。
太棒了,答案是:
在第一次运行 hive 之前,运行
schematool -initSchema -dbType derby
如果您已经运行了 hive,然后尝试 initSchema 但它失败了:
mv metastore_db metastore_db.tmp
重新运行
schematool -initSchema -dbType derby
再次运行hive
**另请注意:如果您更改目录,将找不到上面创建的 metastore_db!我敢肯定这是有充分理由的,我还不知道,因为我今天真的是第一次尝试使用配置单元。啊这里有关于此的信息:无论我运行 Hive 在哪里都创建了 metastore_db
关于hadoop - Hive 安装问题 : Hive metastore database is not initialized,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35655306/