beeline> !connect jdbc:hive2://localhost:10000
Connecting to jdbc:hive2://localhost:10000
Enter username for jdbc:hive2://localhost:10000: root
Enter password for jdbc:hive2://localhost:10000:
19/03/01 22:01:59 [main]: WARN jdbc.HiveConnection: Failed to connect to localhost:10000
Error: Could not open client transport with JDBC Uri: jdbc:hive2://localhost:10000: Failed to open new session: java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): User: root is not allowed to impersonate root (state=08S01,code=0)
原因:
hiveserver2增加了权限控制,需要在hadoop的配置文件中配置
解决办法:
在hadoop的core-site.xml配置文件中添加一下配置内容
通过在core-site.xml中进行如下指定,从任何主机访问的名为root的用户都可以假冒属于任何组的任何用户。
也就是说
用beeline连接hive时的用户名 是什么就在把下面的root替换成什么
<property> <name>hadoop.proxyuser.root.hosts</name> <value>*</value> </property> <property> <name>hadoop.proxyuser.root.groups</name> <value>*</value> </property>
参考:
https://blog.csdn.net/weixin_43713105/article/details/111932704?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_title~default-0.pc_relevant_paycolumn_v3&spm=1001.2101.3001.4242.1&utm_relevant_index=3
https://www.csdn.net/tags/MtTaIgysMjY3NzAtYmxvZwO0O0OO0O0O.html