Foreword: This article is in blogger: http://blog.sina.com.cn/s/blog_7673d4a50102v7s1.html; a summary of the problems encountered on the basis of blogs
Configure the hive's metadata to MySQL, and after creating Hivedb in the MySQL database, modify the Hive-site.xml in the Conf directory of hive and Mysql-connector-java-5.1.22-bin.jar to the Lib directory of hive.
Here's the thing. hive0.14 version
Results run 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 is 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)
........
Check the log of hive: (I am a small white one, check this log as shown on the homepage)
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 is 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)
Searched, executed on MySQL:
Running on the MySQL machine:
ALTER DATABASE hive character set latin1;
mysql> ALTER DATABASE hive character set latin1;
Query OK, 1 row affected (0.13 sec)
Note:
MySQL latin1 UTF8 difference that's more powerful
This is two different encodings, because the number of bytes of the relationship, some countries of the language can not be displayed with Latin1,
So the general use of UTF8 encoding, UTF8 is the universal language coding, both the majority of the language can be used UTF8
Problem solving.
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)