加入收藏 | 设为首页 | 会员中心 | 我要投稿 核心网 (https://www.hxwgxz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

[bigdata-030] cdh 5.9的impyla操作hiveserver2

发布时间:2020-12-31 19:49:39 所属栏目:大数据 来源:网络整理
导读:参考文献:http://www.aichengxu.com/view/11094184 1. cdh 5.9 2. 开发机已经安装了impyla pip install thrift_sasl pip install sasl 3. 在cdh集群的一个节点启动hiveserver2 3.1 修改/etc/hive/conf.cloudera.hive/hive-site.xml 增加属性 property ? nam

参考文献:http://www.aichengxu.com/view/11094184


1. cdh 5.9


2. 开发机已经安装了impyla
pip install thrift_sasl
pip install sasl


3. 在cdh集群的一个节点启动hiveserver2

3.1 修改/etc/hive/conf.cloudera.hive/hive-site.xml

增加属性

<property>
? <name>hive.server2.authentication</name>
? <value>NONE</value>
</property>

将属性hive.server2.enable.doAs设置为false:因为HiveServer2以提交查询的用户执行查询(true),如果hive.server2.enable.doAs设置为false,查询将以运行hiveserver2进程的用户运行。


3.2 启动hiveserver2

nohup hiveserver2 &

注意:cdh的文档说 service hive-server2 start,实际上并没有。


4. 在开发机实现代码:

#!/usr/bin/env python3
#! coding:utf-8 -*-

from impala.dbapi import connect

conn = connect(host='192.168.0.xxx',port=10000,database='default',auth_mechanism='PLAIN')
cur = conn.cursor()

cur.execute('SHOW DATABASES')
print(cur.fetchall())

cur.execute('SHOW Tables')
print(cur.fetchall())

(编辑:核心网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读