hive创建表失败:FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask.

来源:互联网 发布:express.js w3cschool 编辑:程序博客网 时间:2024/05/13 17:22

前言:本文是在博主:http://blog.sina.com.cn/s/blog_7673d4a50102v7s1.html;博客基础上对遇到的问题的一个总结


把hive 的metadata配置成mysql,在mysql数据库里创建了hivedb后,修改hive的conf目录下的hive-site.xml

并且把 mysql-connector-java-5.1.22-bin.jar拷到hive的lib目录下面.
这里用的事hive0.14版本

结果运行hive, create table:
hive> create table t1
    > (tid int, tname string, age int);
Moved: 'hdfs://master:9000/home/hadoop/hive-0.14.0/warehouse/hive_table.db/t1' to trash at: hdfs://master:9000/user/root/.Trash/Current
Moved: 'hdfs://master:9000/home/hadoop/hive-0.14.0/warehouse/hive_table.db/t1' to trash at: hdfs://master:9000/user/root/.Trash/Current
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
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
........

查看hive 的log:(本人小白一个,查的这个日志跟主页上显示的一样)
cat hive.log
2017-01-06 16:29:28,911 ERROR [main]: ql.Driver (SessionState.java:printError(833)) - 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
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)


搜了下,在mysql上执行:

在mysql机器的上运行:

alter database hive character set latin1;

mysql> alter database hive character set latin1;
Query OK, 1 row affected (0.13 sec)

注意:
mysql latin1 utf8区别 那个比较强大
这是两种不同的编码,因为字节数的关系,有些国家的语言不能用latin1显示,
所以一般使用utf8编码,utf8是万国语言编码,既绝大多数国家的语言都可以用utf8


问题解决.

hive> 
    > create table t1                  
    > (tid int, tname string, age int);
OK
Time taken: 0.98 seconds
hive> show tables;
OK
t1
Time taken: 0.04 seconds, Fetched: 1 row(s)

0 0
原创粉丝点击