Hive 远程连接配置

Hive 远程连接配置

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

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

hive.server2.thrift.bind.hostsyq-jtj-jzjxyth-yycx3Bind host on which to run the HiveServer2 Thrift service.

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

  hive.server2.thrift.client.userhduserUsername to use against thrift clienthive.server2.thrift.client.passwordhduserPassword to use against thrift client

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

  hive.server2.thrift.client.userhduserUsername to use against thrift clienthive.server2.thrift.client.passwordhduserPassword to use against thrift clienthadoop.proxyuser.root.hosts *hadoop.proxyuser.root.groups*hadoop.native.libfalse

重启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 远程配置结束


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部