基于MVC网站建设课程设计报告,拓者设计吧现代装修效果图,小众软件wordpress主题,雄安网站制作多少钱前言#xff1a;1、启动HiveServer22、在Linux中安装impyla#xff08;前提是安装Python相关的环境、虚拟环境#xff08;可选#xff09;#xff09; 前言#xff1a;
需求#xff1a;需要通过windows端的pycharm来操作hive。 于是就搜集资料寻找解决方案。 大概有…前言1、启动HiveServer22、在Linux中安装impyla前提是安装Python相关的环境、虚拟环境可选 前言
需求需要通过windows端的pycharm来操作hive。 于是就搜集资料寻找解决方案。 大概有三种方式
pyhs2 连接 hive但是这个项目已经没有人维护了弃用。Pyhive连接hive。imply连接hive。
协商后决定还是用imply。 以下是整个安装以及验证的过程
1、启动HiveServer2
shell cd /usr/local/apache-hive-2.3.1-binshell nohup hiveserver2 1/root/apps/hive-2.1.1/logs/hiveserver.log 2/root/apps/hive-2.1.1/logs/hiveserver.err 后台启动并将hivesever的日志导入对应的目录2、在Linux中安装impyla前提是安装Python相关的环境、虚拟环境可选
# 安装依赖
shell yum -y install gcc gcc-c cyrus-sasl-devel cyrus-sasl-plain# 创建虚拟环境linux下安装虚拟环境参考
shell virtualenv --no-site-packages -p python3 venv# 启用虚拟环境
shelll source venv/bin/activate#linux下python的安装教程见
(venv) shell python -V
Python 3.6.3# 安装 impyla 及所需依赖包
(venv) shell pip install ipython six bit_array thriftpy thrift_sasl0.2.1 sasl impyla(venv) shell ipythonIn [1]: from impala.dbapi import connectIn [2]: conn connect(host192.168.10.45, port10000, databaselogsdb, auth_mechanismPLAIN)In [3]: cur conn.cursor()In [4]: cur.execute(select count(*) from log_bftv_api)In [5]: cur.fetchone()
Out[5]: (1379094425,)In [6]: conn.close()# 程序查出了 hive table log_bftv_api 中总共有 1379094425 条数据。你也可以到对应yarn的web界面去查看对应执行进度或者在1中配置的日志文件中查看执行的过程。# 其中连接配置中 auth_mechanism 的值由 hive-site.xml 配置文件中 hive.server2.authentication 配置项指定你需要到对应的hiveserver2节点的hive-site中添加如下配置:
propertynamehive.server2.authentication/namevaluePLAIN/value
/property。# PLAIN 代表不启用认证也就是 hive.server2.authentication 的默认值NONE。
转自https://www.cnblogs.com/wangxiaoqiangs/p/7850953.html