【问题标题】:Creating a Hive table automatically changes charset settings of mysql metastore创建 Hive 表会自动更改 mysql Metastore 的字符集设置
【发布时间】:2012-10-18 10:17:45
【问题描述】:

我将 Hive 配置为使用 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 和 official 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)

我将所有字符集设置从utf8 更改为latin1,除了character_set_filesystemcharacter_set_systemcharacter_sets_dir

即使这样做,当我尝试删除表时,我仍然会遇到相同的错误。 更糟糕的是,每当我创建新表时,mysql 字符集设置都会重置为utf-8

有人可以帮忙吗?

【问题讨论】:

    标签: mysql hadoop integration hive meta


    【解决方案1】:

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

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

    将数据库名称更改为您已经在 mysql 中创建的“metastore”,如下所示

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

    希望这能解决我遇到同样问题的问题,然后我就这样解决了。 友好的马图克

    【讨论】:

      猜你喜欢
      • 2022-06-14
      • 1970-01-01
      • 2014-02-22
      • 1970-01-01
      • 1970-01-01
      • 2023-03-06
      • 2013-05-20
      • 2014-08-27
      • 2016-08-01
      相关资源
      最近更新 更多