<span style="font-family:Microsoft YaHei;"><span style="font-family:Microsoft YaHei;font-size:12px;">16/10/07 06:43:09 [2af60edc-63e5-4fed-adc1-c8e15dca3f34 2af60edc-63e5-4fed-adc1-c8e15dca3f34 main]: ERROR metastore.RetryingHMSHandler: HMSHandler Fatal error: 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.GeneratedConstructorAccessor44.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)</span></span>
解决:
用 root 登录mysql,然后修改hive数据库的字符集
mysql> show variables like '%char%';
<span style="font-family:Microsoft YaHei;"><span style="font-family:Microsoft YaHei;font-size:12px;">mysql>alter database hive(库名) character set latin1; mysql>flush privileges;</span></span>
修改表结构的时候i,报告错误
<span style="font-family:Microsoft YaHei;"><span style="font-family:Microsoft YaHei;">hive> > ALTER TABLE cwqsolo CHANGE id id String; FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Unable to alter table. For direct MetaStore DB connections, we don't support retries at the client level. hive> </span></span>
解决:
这个是因为hive用到的mysql 连接包版本不匹配的原因。 我安装的mysql 是 5.6.33,从网络上下载了一个mysql-connector-java-5.1.36.jar,替换,重启hive,问题解决。
<span style="font-family:Microsoft YaHei;">[root@archive lib]# pwd /opt/hadoop/hive/lib [root@archive lib]# ls -l mysql-connector-java* -rw-r--r-- 1 root root 972007 Oct 7 07:06 mysql-connector-java-5.1.36.jar -rw-r--r-- 1 root root 703265 Sep 19 17:52 mysql-connector-java-5.1.6-bin.jar [root@archive lib]# [root@archive lib]# mv mysql-connector-java-5.1.6-bin.jar mysql-connector-java-5.1.6-bin.jar.bak</span>
hive -hiveconf hive.root.logger=DEBUG,console