写在前面:我的需求是使用python连接hive数据库,读取数据库中的数据。首先,我自己搭建了hadoop集群,包含三个节点,安装了hive数据库,导入了一些数据。在这过程中,遇到了很多错误,查找了很多文档,现在简单整理一下思路方便以后查找。
1.环境说明:
win10
python编译器:PyCharm
集群环境:
CentOS 6.7
hadoop 2.7.3
hive 2.3.2
2.大致步骤
总体来说分为两个步骤。(1)配置hiveserver2(2)基于implay连接hive数据库,读取数据
2.1配置hiveserver2
(1)修改hdfs-site.xml、core-site.xml、hive-site.xml。分别在这三个配置文件中添加如下内容:
hdfs-site.xml:表示启用 webhdfs
<property>
<name>dfs.webhdfs.enabled</name>
<value>true</value>
</property>
core-site.xml:
<property>
<name>hadoop.proxyuser.root.hosts</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.root.groups</name>