impala 不能查询的问题

时区对impala的影响

Posted by xuefly on July 14, 2019

背景

新开的节点搭建impala集群,

每次ssh 连接报错:

ubuntu@id-cdh-manager:~$ ssh -i-bash: warning: setlocale: LC_CTYPE: cannot change locale (zh_CN.UTF-8)
-bash: warning: setlocale: LC_CTYPE: cannot change locale (zh_CN.UTF-8)
echo "LC_ALL=en_US.UTF-8" >> /etc/environment
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
locale-gen en_US.UTF-8

或者

echo "LC_ALL=zh_CN.UTF-8" >> /etc/environment
echo "zh_CN.UTF-8 UTF-8" >> /etc/locale.gen
echo "LANG=zh_CN.UTF-8" > /etc/locale.conf
locale-gen zh_CN.UTF-8

参考:找到的解决方法参考:https://github.com/sylabs/singularity/issues/11

后来运维部门,手工修改了时区。

现象

  • Python连接impala报的错误:
    Failed after retrying 3 times
    exception
    
  • impala shell报的错误
    impala-shell -V -i id-cdh-slave-102
    Starting Impala Shell without Kerberos authentication
    Connected to id-cdh-slave-102:21000
    Server version: impalad version 2.11.0-cdh5.14.0 RELEASE (build d68206561bce6b26762d62c01a78e6cd27aa7690)
    [id-cdh-slave-102:21000] > select * from snap.tidb_tifeaturedb_r_u02_001_u02_030 limit 1;
    Query: select * from snap.tidb_tifeaturedb_r_u02_001_u02_030 limit 1
    Query submitted at: 2019-07-14 04:11:09 (Coordinator: http://id-cdh-slave-102:25000)
    Error communicating with impalad: TSocket read 0 bytes
    [Not connected] > Goodbye hive
    
  • hue报的错误
  • cloudera manager 界面上只要已查询,daemon 就报错,不查的时候只是显示查询状态没有ready

解决

测试的时候为便于调试,重新搭建最小规模的impala集群。

开始时候想到的原因

  • 依赖的问题之前新装了一个Python3
  • 网络问题,hue上报的错误确实是unreachable host:port
  • 触发了阿里云的什么bug

如果按照这个Error communicating with impalad: TSocket read 0 bytes去找解决方案就跑偏了,看了很多文章都没用。

看到查看服务日志/var/log/impalad$ tail -f impalad.ERROR

Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg
E0714 04:17:53.441355  6356 logging.cc:121] stderr will be logged to this file.
Picked up JAVA_TOOL_OPTIONS:
terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid
Wrote minidump to /var/log/impala-minidumps/impalad/71d1b672-5c6a-4096-95d2c383-6bc0654d.dmp

关键是:

terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid

尝试 1

在impala启动的时候会报一些local配置的问题 在/etc/profile中添加,但是没效果。

export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8

尝试 2

  • 修改:/etc/environment 添加 LC_ALL=en_US.UTF-8
    ubuntu@id-cdh-manager:~/scripts$ more /etc/environment
    PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
    LC_ALL=en_US.UTF-8
    
  • /etc/locale.gen:打开en_US.UTF-8的注释

验证:

root@id-cdh-manager:/home/ubuntu/scripts# locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

重启节点后对impala才生效。

参考 https://github.com/potree/PotreeConverter/issues/281