使用jdbc連接hive報(bào)錯(cuò):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>