无法使用beeline连接到hive,用户root无法模仿匿名

ser*_*ava 5 hadoop hive beeline

我正在尝试使用beeline连接到hive !connect jdbc:hive2://localhost:10000,我被要求输入用户名和密码


Connecting to jdbc:hive2://localhost:10000' Enter username for jdbc:hive2://localhost:10000: Enter password for jdbc:hive2://localhost:10000:


因为我不知道我应该输入什么用户名或密码我将它留空导致错误:Error: 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 anonymous (state=,code=0) 我的设置是ubuntu中的单个节点hadoop集群.我可以确认服务已启动并运行,包括hadoop和hiveserver2

问题是,这些用户名和密码是什么,我被问到,在哪里可以找到它们或设置它们?

提前致谢

小智 8

在 hive-site.xml 中需要将参数 hive.server2.enable.doAs 设置为 false

<property>
<name>hive.server2.enable.doAs</name>
<value>FALSE</value>
<description>
Setting this property to true will have HiveServer2 execute
Hive operations as the user making the calls to it.
</description>
</property> 
Run Code Online (Sandbox Code Playgroud)

http://mail-archives.apache.org/mod_mbox/hive-user/201602.mbox/%3C54b7754ceb8370b7250bba929369763f@cloudtechnologypartners.co.uk%3E


fra*_*ijo 5

您应该提供有效usernamepassword具有访问HDFS和Hive服务(user运行HiveServer2)的权限.对于您的设置,user安装Hadoop和Hive的用户将是超级用户.

这些凭据将用于beeline启动与HiveServer2的连接.

并且,添加这些属性 core-site.xml

<property>
  <name>hadoop.proxyuser.username.groups</name>
  <value>*</value>
</property>
<property>
  <name>hadoop.proxyuser.username.hosts</name>
  <value>*</value>
</property>
Run Code Online (Sandbox Code Playgroud)

添加这些属性后重新启动服务.

  • 在core-site.xml文件中,`hadoop.proxyuser.&lt;username&gt;.hosts`这里的`&lt;username&gt;`必须与`beeline`中使用的相同, (5认同)
  • 谢谢,这就是问题,hadoop.proxyuser.root.hosts工作. (2认同)
  • @franklinsijo谢谢。参数名中的用户名是我需要的东西。其他2000页,但没有人提到。 (2认同)