Hive部署远程模式 您所在的位置:网站首页 千锋教育ui课程安装教程 Hive部署远程模式

Hive部署远程模式

2023-06-01 17:59| 来源: 网络整理| 查看: 265

远程模式

简介

将hive中的相关进程比如hiveserver2或者metastore这样的进程单独开启,使用客户端工具或者命令行进行远程连接这样的服务,即远程模式。客户端可以在任何机器上,只要连接到这个server,就可以进行操作。客户端可以不需要密码。

服务端的配置

1) 修改 hive-site.xml

hive.metastore.warehouse.dir /user/hive/warehouse location of default database for the warehouse hive.exec.scratchdir /tmp/hive javax.jdo.option.ConnectionURL jdbc:mysql://qianfeng03:3306/hive?createDatabaseIfNotExist=true;characterEncoding=latin1 javax.jdo.option.ConnectionDriverName com.mysql.cj.jdbc.Driver javax.jdo.option.ConnectionUserName root javax.jdo.option.ConnectionPassword 123456 hive.exec.local.scratchdir /usr/local/hive/iotmp/root hive.server2.logging.operation.log.location /usr/local/hive/iotmp/root/operation_logs hive.querylog.location /usr/local/hive/iotmp/root hive.downloaded.resources.dir /usr/local/hive/iotmp/${hive.session.id}_resources 复制代码

 说明:

使用远程模式,需要在hadoop的$HADOOP_HOME/etc/hadoop/core-site.xml文件中添加一下属性,修改之后分发给不同节点 hadoop.proxyuser.root.hosts * hadoop.proxyuser.root.groups * 复制代码

远程模式是一个服务器在在一台节点,客户端在其他节点上

将qianfeng01的节点作为服务器节点,将qianfeng02作为客户端节点,将qianfeng01节点中配置好hive远程发送给qianfeng02节点

scp -r ./hive-3.1.2/ root@qianfeng02:$PW 复制代码

hive的两种服务说明

第一种服务:hiveserver2

1. 该服务端口号默认是10000 2. 可以单独启动此服务进程,供远程客户端连接;此服务内置metastore服务。 3. 启动方式: 方法1: 直接调用hiveserver2。会进入监听状态不退出。 方法2: hive --service hiveserver2 & 进入后台启动 方法3: hive --service hiveserver2 >/dev/null 2>&1 &; #信息送入黑洞。 复制代码

第二种服务:metastore(hive链接方式)

1. 此服务才是真正连接元数据库的服务进程 2. 也可以让远程客户端连接 3. 启动方式: 方法1: - hive --service metastore & 方法2: - hive --service metastore 2>&1 >/dev/null &; #信息送入黑洞。 复制代码

客户端连接hiveserver2服务

说明:

将qianfeng01的hive发送到qianfeng02中,qianfeng02连接此服务的hive客户端,需要配好环境变量修改hive-site.xml,修改hive.server2.thrift.bind.host的值为hiveserver2的服务端只能使用hive中的beeline连接工具进行连接此服务,beeline是hive的一个轻量级的连接客户端工具

连接方式:

方式1: step1. beeline 回车 step2. !connect jdbc:hive2://ip:10000 回车 step3. 输入用户名 回车 step4. 输入密码 回车 方法2(直连): 1. beeline -u jdbc:hive2://ip:10000 -n 用户名 退出 !quit 解析: hive2,是hive的协议名称 ip: hiveserver2服务所在的主机IP。 10000,是hiveserver2的端口号d 复制代码

客户端连接metastore服务

注意:想要连接metastore服务的客户端必须配置如下属性和属性值

hive.metastore.uris thrift://ip:9083 使用的是bin下的hive命了 解析:thrift:是协议名称 ip为metastore服务所在的主机ip地址 9083是默认端口号

也可以观看视频:

千锋大数据Hadoop全新增强版-先导片

 



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有