zhaohz

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

### impyla-0.14.2.2安装注意事项
+ 环境
- Red Hat Enterprise Linux Server release 6.8 (Santiango)
- Python3.7.3

+ impyla-0.14.2.2依赖包
- yum install -y python-devel cyrus-sasl cyrus-sasl-devel cyrus-sasl-lib
- thrift - 0.11.0
- sasl - 0.2.1
- thrift_sasl - 0.2.1
- thriftpy - 0.3.9

+ 问题1: syntax error near 'async=True)' 报错
- hiveserver2.py 第340行 `async=True)` 改为 `async2=True)` (估计async是关键字)
- hiveserver2.py 第1022行 `async=False)` 改为 `async2=False)`
- hiveserver2.py 第1026行 `=async)` 改为 `=async2)`

+ 问题2:'TSocket' object has no attribute 'isOpen'报错?
- 把 thrift_sasl 从0.3.0换成0.2.1版本 (在python2.7中0.3.0没问题)

+ 问题3:No protocol version header
- connect函数需要指定 user, password, auth_mechanism = 'PLAIN'

+ 问题4:报错sasl/sasl.h: No such file or directory
- yum install -y cyrus-sasl cyrus-sasl-devel cyrus-sasl-lib

+ 示例

```python

from impala.dbapi import connect

conn = connect(host='hadoop01', port=10000, user='hadoop', password='hadoop', auth_mechanism = 'PLAIN')
cursor = conn.cursor()
cursor.execute('SHOW DATABASES')
for result in cursor.fetchall():
print(result)

```

+ 注意启动hiveserver2
```bash
nohup hive --service hiveserver2 > nohup.hiveserver2&
```

posted on 2019-12-29 23:16  zzhaoh  阅读(281)  评论(0编辑  收藏  举报