1,配置hive:启动hiveserver2
在 bin/conf 下面touch 一个hive-site,xml:
添加
<?xml version="1.0" encoding="UTF-8" standalone="no"?><?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>hive.server2.thrift.port</name>
<value>10000</value>
<description>Port number of HiveServer2 Thrift interface when hive.server2.transport.mode is 'binary'.</description>
</property>
<property>
<name>hive.server2.thrift.bind.host</name>
<value>127.0.0.1</value>
<description>Bind host on which to run the HiveServer2 Thrift service.</description>
</property>
<property>
<name>hive.server2.enable.doAs</name>
<value>false</value>
<description>
Setting this property to true will have HiveServer2 execute
Hive operations as the user making the calls to it.
如果为True:Hive Server会以提交用户的身份去执行语句
如果为False:会以hive server daemon的admin user来执行语句
</configuration>
后台启动:
1 |
|
或者直接:
1 |
|
python :
下载:
pip install sasl
pip install thrift
pip install thrift-sasl
pip install PyHive
hive.Connection(host=host, port=port, database=database)#没有设置用户密码