启动 Impala-shell 报错如下
[root@xxx ~]# impala-shellFile "/opt/cloudera/parcels/CDH-5.13.0-1.cdh5.13.0.p0.29/bin/../lib/impala-shell/impala_shell.py", line 222print '\tNo options available.'^
SyntaxError: Missing parentheses in call to 'print'
发现语法不支持,2.x 与3.x 语法有很大区别,我们这台机器python 版本为 3.x,寻找Impala-shell 执行脚本
发现在目录 /opt/cloudera/parcels/CDH-5.13.0-1.cdh5.13.0.p0.29/bin 下
vim 查看脚本,发现最后一行有执行 python xxx
PYTHONPATH="${EGG_PATH}${SHELL_HOME}/gen-py:${SHELL_HOME}/lib:${PYTHONPATH}" \exec python ${SHELL_HOME}/impala_shell.py "$@"
因为python默认是3.x版本,把 python修改成python2 ,重新运行,ok
[root@xxx bin]# impala-shell
Starting Impala Shell without Kerberos authentication
Error connecting: TTransportException, TSocket read 0 bytes
Kerberos ticket found in the credentials cache, retrying the connection with a secure transport.
Connected to hostname.zh:21000
Server version: impalad version 2.10.0-cdh5.13.0 RELEASE (build 2511805f1eaa991df1460276c7e9f19d819cd4e4)
***********************************************************************************
Welcome to the Impala shell.
(Impala Shell v2.10.0-cdh5.13.0 (2511805) built on Wed Oct 4 10:55:37 PDT 2017)To see a summary of a query's progress that updates in real-time, run 'set
LIVE_PROGRESS=1;'.
***********************************************************************************
[hostname.zh:21000] > show tables;
Query: show tables
+------+
| name |
+------+
| test |
+------+
Fetched 1 row(s) in 0.03s
[hostname.zh:21000] >