• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

Hive 远程连接配置

武飞扬头像
爱当厨子的小章同学
帮助1

Hive 远程连接配置

1、配置 hive-site.xml 中的内容

打开 hive-site.xml 搜索 hive.server2.thrift.bind.host 如果存在则修改 value 值为 本机 域名或 ip

<property>
		<name>hive.server2.thrift.bind.host</name>
		<value>syq-jtj-jzjxyth-yycx3</value>
		<description>Bind host on which to run the HiveServer2 Thrift service.</description>
</property>

配置beeline远程客户端连接时的用户名和密码。这个用户名要在对应的hadoop的配置文件core-site.xml中也配置

  <property>
    <name>hive.server2.thrift.client.user</name>
    <value>hduser</value>
    <description>Username to use against thrift client</description>
  </property>
  <property>
    <name>hive.server2.thrift.client.password</name>
    <value>hduser</value>
    <description>Password to use against thrift client</description>
  </property>

2、配置对应hadoop 中的 core-site.xml

  <property>
    <name>hive.server2.thrift.client.user</name>
    <value>hduser</value>
    <description>Username to use against thrift client</description>
  </property>
  <property>
    <name>hive.server2.thrift.client.password</name>
    <value>hduser</value>
    <description>Password to use against thrift client</description>
  </property>
	<property>
		<name>hadoop.proxyuser.root.hosts</name> <!-- root为当前Linux的用户,我的是root用户 -->
		<value>*</value>
	</property>
	<property>
		<name>hadoop.proxyuser.root.groups</name>
		<value>*</value>
	</property>
	<property>
		<name>hadoop.native.lib</name>
		<value>false</value>
	</property>

重启hadoop

3、验证 hive beeline 连接以及其他客户端连接

1、启动 hiveserver2 进入 hive/bin目录下 执行 ./hiveserver2 启动hive 测试阶段使用的启动方式,关闭shell 窗口 进程就自动关闭。
产线情况下启动使用后台启动方式
启动hiveserver2
beeline
!connect jdbc:hive2://localhost:10000 hive hive
后台运行
hiveserver2 nohup hive --service hiveserver2 &

[root@syq-jtj-jzjxyth-yycx3 bin]# ./hiveserver2 
which: no hbase in (/usr/jdk1.8/bin:/usr/jdk1.8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/hadoop/bin:/root/bin:/opt/hadoop/bin:/opt/hive/bin)
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/hive/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]

重新打开一个shell 窗口 进入 hive/bin目录下 执行 ./beeline 如下 然后输入上面配置文件里的用户名密码 ,登录 测试beeline 连接

[root@syq-jtj-jzjxyth-yycx3 bin]# ./beeline
which: no hbase in (/usr/jdk1.8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/hadoop/bin:/root/bin)
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/hive/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Beeline version 2.1.1 by Apache Hive
beeline> !connect jdbc:hive2://10.75.8.44:10000
Connecting to jdbc:hive2://10.75.8.44:10000
Enter username for jdbc:hive2://10.75.8.44:10000: hduser
Enter password for jdbc:hive2://10.75.8.44:10000: ******
Connected to: Apache Hive (version 2.1.1)
Driver: Hive JDBC (version 2.1.1)
22/04/06 22:38:26 [main]: WARN jdbc.HiveConnection: Request to set autoCommit to false; Hive does not support autoCommit=false.
Transaction isolation: TRANSACTION_REPEATABLE_READ
0: jdbc:hive2://10.75.8.44:10000> show databases;
 ---------------- -- 
| database_name  |
 ---------------- -- 
| default        |
| ods            |
 ---------------- -- 
2 rows selected (1.635 seconds)
0: jdbc:hive2://10.75.8.44:10000>

到此 hive 远程配置结束

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhghbaig
系列文章
更多 icon
同类精品
更多 icon
继续加载