使用jdbc连接hive报错:java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoo...

使用jdbc连接hive报错:Connecting to jdbc:hive2://node002:10000
21/08/01 22:12:31 [main]: WARN jdbc.HiveConnection: Failed to connect to node002:10000
Could not open connection to the HS2 server. Please check the server URI and if the URI is correct, then ask the administrator to check the server status.
Error: Could not open client transport with JDBC Uri: jdbc:hive2://node002:10000: java.net.ConnectException: 拒绝连接 (Connection refused) (state=08S01,code=0)
Beeline version 3.1.2 by Apache Hive

解决办法:https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/Superusers.html

示例:bin/beeline -u jdbc:hive2://node002:10000 -n dataManager
hdfs core-site.xml 添加如下配置:

<property>
<name>hadoop.proxyuser.dataManager.hosts</name>
<value>node001,node002,node003</value>
</property>
<property>
<name>hadoop.proxyuser.dataManager.groups</name>
<value>dataManager</value>
</property>

Configurations
You can configure proxy user using properties hadoop.proxyuser.$superuser.hosts along with either or both of hadoop.proxyuser.$superuser.groups and hadoop.proxyuser.$superuser.users.

By specifying as below in core-site.xml, the superuser named super can connect only from host1 and host2 to impersonate a user belonging to group1 and group2.

<property>
<name>hadoop.proxyuser.super.hosts</name>
<value>host1,host2</value>
</property>
<property>
<name>hadoop.proxyuser.super.groups</name>
<value>group1,group2</value>
</property>

If these configurations are not present, impersonation will not be allowed and connection will fail.

If more lax security is preferred, the wildcard value * may be used to allow impersonation from any host or of any user. For example, by specifying as below in core-site.xml, user named oozie accessing from any host can impersonate any user belonging to any group.

<property>
<name>hadoop.proxyuser.oozie.hosts</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.oozie.groups</name>
<value>*</value>
</property>

The hadoop.proxyuser.$superuser.hosts accepts list of ip addresses, ip address ranges in CIDR format and/or host names. For example, by specifying as below, user named super accessing from hosts in the range 10.222.0.0-10.222.255.255 and 10.113.221.221 can impersonate user1 and user2.

<property>
<name>hadoop.proxyuser.super.hosts</name>
<value>10.222.0.0/16,10.113.221.221</value>
</property>
<property>
<name>hadoop.proxyuser.super.users</name>
<value>user1,user2</value>
</property>

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容