hive创建表失败,drop表失败
一、hive创建表失败,报错:
创新互联建站是一家专注于网站建设、成都网站制作与策划设计,耀州网站建设哪家好?创新互联建站做网站,专注于网站建设十载,网设计领域的专业建站公司;建站业务涵盖:耀州等地区。耀州做网站价格咨询:028-86922220
CREATE TABLE pokes (foo INT, bar STRING);
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:javax.jdo.JDODataStoreException: An exception was thrown while adding/validating class(es) : Specified key was too long; max key length is 767 bytes
com.MySQL.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes
解决方法:
mysql> SET @@global.innodb_large_prefix = 1;
mysql> ALTER DATABASE hivedb character set latin1;
二、drop表报错卡主,日志看不到信息,
解决方法:
方法一:最后找到问题是mysql5.6.30,换了一个mysql5.1数据库版本,解决问题
方法二:针对mysql5.6.30的bug,需要手动初始化hive metastore,否则用户在drop table时候会卡主。在dmp-gateway数据库(配置文件中指定的mysql)
[root@DMP-GATEWAY ~]# cd /opt/amos/hive/bin/
[root@DMP-GATEWAY bin]# ./schematool -dbType mysql –initSchema
结果:
Starting metastore schema initialization to 1.2.0
Initialization script hive-schema-1.2.0.mysql.sql
Initialization script completed
查看数据库:
[root@DMP-GATEWAY ~]# mysql -uroot –p
mysql> show databases;
--------------------
Database
--------------------
information_schema
exp
hive
hivedb 可以看到hivedb数据库被创建
三、在mestatore初始化后,会自动创建hivedb数据库,清空所有表,或者
drop database hivedb
create database hivedb
source hive-txn-schema-0.14.0.mysql.sql
source hive-schema-1.2.0.mysql.sql
git地址:
https://github.com/apache/hive/tree/release-1.2.1/metastore/scripts/upgrade/mysql
四、报错
no library native-lzo
需要 yum install -y lzo
标题名称:hive创建表失败,drop表失败
URL分享:http://azwzsj.com/article/jjhisg.html