hive初始化数据库失败 org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization FAILED!
问题:安装好hive后,执行初始化数据库命令schematool -dbType mysql -initSchema,出现以下错误:Starting metastore schema initialization to 2.3.0Initialization script hive-schema-2.3.0.mysql.sqlError: Got error 168 from storage en
问题:
安装好hive后,执行初始化数据库命令schematool -dbType mysql -initSchema,出现以下错误:
Starting metastore schema initialization to 2.3.0
Initialization script hive-schema-2.3.0.mysql.sql
Error: Got error 168 from storage engine (state=HY000,code=1030)
org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization FAILED! Metastore state would be inconsistent !!
Underlying cause: java.io.IOException : Schema script failed, errorcode 2
Use --verbose for detailed stacktrace.
*** schemaTool failed ***
执行命令 schematool -dbType mysql -initSchema --verbose 查看问题详情:
jdbc:mysql://39.106.229.57:3306/hive> CREATE TABLE IF NOT EXISTS BUCKETING_COLS ( SD_ID bigint(20) NOT NULL, BUCKET_COL_NAME varchar(256) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL, INTEGER_IDX int(11) NOT NULL, PRIMARY KEY (SD_ID,INTEGER_IDX), KEY BUCKETING_COLS_N49 (SD_ID), CONSTRAINT BUCKETING_COLS_FK1 FOREIGN KEY (SD_ID) REFERENCES SDS (SD_ID) ) ENGINE=InnoDB DEFAULT CHARSET=latin1
Error: Got error 168 from storage engine (state=HY000,code=1030)
Closing: 0: jdbc:mysql://39.106.229.57:3306/hive
org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization FAILED! Metastore state would be inconsistent !!
Underlying cause: java.io.IOException : Schema script failed, errorcode 2
org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization FAILED! Metastore state would be inconsistent !!
发现是创建表BUCKETING_COLS时出现了问题。
解决方法:
百度了好久,找到了一个办法,就是将hive数据库的字符集改成latin1:
mysql> alter database hive character set latin1;
再次初始化数据库但还是出现同样的错误,最后想起自己在安装mysql时,在/etc/my.cnf文件里设置了默认字符集为utf-8:
将这两行注释或者删掉后重启mysql服务:systemctl restart mysqld.service
再次初始化数据库,终于成功了,泪目
更多推荐

所有评论(0)