Hive 远程连接配置,这个用户名要在对应的
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 远程配置结束
本站文章为和通数据库网友分享或者投稿,欢迎任何形式的转载,但请务必注明出处.
同时文章内容如有侵犯了您的权益,请联系QQ:970679559,我们会在尽快处理。