(四)hive的搭建2

在(三)hive的搭建1中我们搭建好了hive环境,但是只能本地访问,在本节中配置Hive的访问方式。

1.元数据服务的方式

1.1 编辑hive-site.xml

sudo vi hive-site.xml

在文件最后增加以下内容

<!-- 指定存储元数据要连接的地址 -->

<property>

<name>hive.metastore.uris</name>

<value>thrift://hadoop-master:9083</value>

</property>

1.2 启动metastore

执行命令

hive --service metastore (此命令启动后窗口不可再进行操作)

或者hive --service metastore & (后台方式启动metastore )

1.3查看HiveMetaStore进程

ps -ef | grep HiveMetaStore

1.4 启动Hive

在另一个窗口执行命令

hive

2.JDBC的方式

通过JDBC访问hive,首先需要配置好1.元数据服务的方式。元数据服务访问Hive 。JDBC的方式是通过server2访问元数据服务的。

2.1配置hive-site.xml

sudo vi hive-site.xml

在文件最后增加以下内容

<!-- 指定hiveserver2连接的host -->

<property>

<name>hive.server2.thrift.bind.host</name>

<value>hadoop-master</value>

</property>

<!-- 指定 hiveserver2 连接的端口号 -->

<property>

<name>hive.server2.thrift.port</name>

<value>21000</value>

</property>

2.2启动hiveserver2

执行命令(注意启动前先要参考1.中的命令启动metastore )

hive --service hiveserver2 (启动后窗口无法再进行操作)

或hive --service hiveserver2 & (后台方式启动)

2.3查看HiveServer2进程

ps -ef | grep hiveserver2

2.4查看thrift端口是否启动

sudo netstat -tunpl | grep 21000

2.4使用beeline客户端连接

执行命令

beeline -u jdbc:hive2://hadoop-master:21000 -n user

2.5 访问HiveServer2的Web页面

访问地址http://hadoop-master:10002/

相关推荐
geovindu1 天前
SQL Data Sampling and Approximation Techniques using postgreSQL 18
大数据·数据库·数据仓库·sql·postgresql·数据库开发·数据库架构
skywalk81631 天前
hive —— 多机 AI Agent 协同的任务总线:分布式,多节点同时运行,保障不会宕机
人工智能·hive·分布式
程序员梅雨2 天前
【从零开始学习数据仓库 | 第一篇】:维度建模理论
大数据·数据仓库·学习·阿里云·数据分析
棣廷2 天前
初识数据仓库——数仓分层到DataX数据采集
数据仓库
棣廷2 天前
初识Hive(2)
数据仓库·hive·hadoop
skywalk81632 天前
deepseek对skywalk163/hive 和hivecommons/hive 两个多机AI Agent任务调度项目的对比
人工智能·hive·agent
father_12273 天前
【ambari管理下hdp2.6.5升级hive1.2.1-2.1.0-2.3.3】
hive·hadoop·ambari
geovindu3 天前
Pivoting and Unpivoting Data in SQL using postgreSQL 18
大数据·数据库·数据仓库·sql·postgresql·数据库开发·数据库架构
数据库小学妹3 天前
OLAP数据库怎么选?看清OLTP、数仓、湖仓边界
数据仓库·mpp·列式存储·联机分析处理·数据库选型·olap数据库