创建配置单元表会自动更改mysql metastore的字符集设置

j7dteeu8  于 2021-06-03  发布在  Hadoop
关注(0)|答案(1)|浏览(355)

我将配置单元配置为使用mysql元存储。很好用。
但当我试图删除一个表时,我会遇到如下错误。

FAILED: Error in metadata: javax.jdo.JDODataStoreException: Error(s) were found while auto-creating/validating the datastore for classes. The errors are printed in the log, and are attached to this exception.
NestedThrowables:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask

我做了一些研究,google和官方的faq告诉我,改变mysql字符集设置可以解决这个问题。
我的mysql设置如下

mysql> show variables like '%char%';
+--------------------------+----------------------------------------+
| Variable_name            | Value                                  |
+--------------------------+----------------------------------------+
| character_set_client     | utf8                                   |
| character_set_connection | utf8                                   |
| character_set_database   | utf8                                   |
| character_set_filesystem | binary                                 |
| character_set_results    | utf8                                   |
| character_set_server     | utf8                                   |
| character_set_system     | utf8                                   |
| character_sets_dir       | /usr/local/mysql/share/mysql/charsets/ |
+--------------------------+----------------------------------------+
8 rows in set (0.02 sec)

我更改了所有角色集设置 utf8latin1 ,除了 character_set_filesystem , character_set_system , character_sets_dir .
即使这样做,当我尝试删除表时仍然会出现相同的错误。更糟糕的是,每当我创建一个新表时,mysql字符集设置都会重置为 utf-8 .
有人能帮忙吗?

nkoocmlb

nkoocmlb1#

问题是,在hive-site.xml中,它在创建下面的“hive”时使用了另一个数据库

<property>
 <name>javax.jdo.option.ConnectionURL</name>
 <value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true</value>
 </property>

将数据库名称更改为“metastore”,您已经在mysql中创建了这样的数据库

<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost:3306/metastore?createDatabaseIfNotExist=true</value>
</property>

希望这个regle的问题,我有同样的问题,我这样解决它。弗林德利马托克

相关问题