执行下面的命令:
beeline>
beeline> !connect jdbc:hive2://host6:10000
Connecting to jdbc:hive2://host6:10000
Enter username for jdbc:hive2://host6:10000: hive
Enter password for jdbc:hive2://host6:10000: ****
17/06/23 17:28:51 [main]: WARN jdbc.HiveConnection: Failed to connect to host6:10000
Error: Could not open client transport with JDBC Uri: jdbc:hive2://host6:10000: Failed to open new session: java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): User: hduser is not allowed to impersonate hive (state=08S01,code=0)
beeline>
日志开头部分:
2017-06-23T17:26:17,861 INFO [HiveServer2-Handler-Pool: Thread-34] thrift.ThriftCLIService: Client protocol version: HIVE_CLI_SERVICE_PROTOCOL_V9
2017-06-23T17:26:17,891 INFO [HiveServer2-Handler-Pool: Thread-34] hive.metastore: Trying to connect to metastore with URI thrift://host6:9083
2017-06-23T17:26:17,892 INFO [HiveServer2-Handler-Pool: Thread-34] hive.metastore: Opened a connection to metastore, current connections: 2
2017-06-23T17:26:17,900 WARN [HiveServer2-Handler-Pool: Thread-34] security.ShellBasedUnixGroupsMapping: unable to return groups for user hive
PartialGroupNameException The user name 'hive' is not found. id: hive: No such user
id: hive: No such user
但是我的core-site.xml
文件也加了下面的配置,并且重启了hadoop
<property>
<name>hadoop.proxyuser.hduser.hosts</name>
<value>hduser</value>
</property>
<property>
<name>hadoop.proxyuser.hduser.groups</name>
<value>host6</value>
</property>
hive-site.xml
的配置:
<property>
<name>beeline.hs2.connection.user</name>
<value>hive</value>
</property>
<property>
<name>beeline.hs2.connection.password</name>
<value>hive</value>
</property>
<property>
<name>beeline.hs2.connection.hosts</name>
<value>localhost:10000</value>
</property>
此外,使用嵌入模式可以连接成功。