1、今天遇到一个问题,在连接到hive之后,无法执行任何命令。
$ beeline -u "jdbc:hive2://hostname.domain.cn:10000/default;principal=hive/_HOST@domain.com;"
Connecting to jdbc:hive2://hostname.domain.cn:10000/default;principal=hive/_HOST@domain.com;
Connected to: Apache Hive (version release-1.2.1-EDH-1.1.2)
Driver: Hive JDBC (version release-1.2.1-EDH-1.1.2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version release-1.2.1-EDH-1.1.2 by Apache Hive
0: jdbc:hive2://hostname.domain.cn:10000> show databases;
返回的错误如下
Error: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException
(message:For direct MetaStore DB connections, we don't support retries at the client level.) (state=08S01,code=1)
2、百度这个问题,很多的文档都是提及字符集的问题,需要保证mysql的字符集是latin
mysql> show variables like '%collation_%';
+----------------------+-------------------+
| Variable_name | Value |
+----------------------+-------------------+
| collation_connection | latin1_swedish_ci |
| collation_database | latin1_swedish_ci |
| collation_server | latin1_swedish_ci |
+----------------------+-------------------+
3、如果字符集不是latin1,需要手动执行(本次问题,不是这个,我的字符集,原本就是latin1)
mysql>use hive
mysql>alter database hive character set latin1;
4、后来尝试重启一下hive,结果,metastore竟然启动失败。查看日志,说创建表失败。这个hive已经运行一段时间了,一直没有问题。对应的表也都是存在的,没有道理重建的。
Ambari Hive 无法正常查询 问题分析处理
5、日志输出为下:
Traceback (most recent call last):
File "/var/lib/ambari-agent/cache/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py", line 259, in <module>
HiveMetastore().execute()
File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 280, in execute
method(env)
File "/var/lib/ambari-agent/cache/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py", line 59, in start
self.configure(env)
File "/var/lib/ambari-agent/cache/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py", line 73, in configure
hive(name = 'metastore')
File "/usr/lib/python2.6/site-packages/ambari_commons/os_family_impl.py", line 89, in thunk
return fn(*args, **kwargs)
File "/var/lib/ambari-agent/cache/