简体   繁体   English

使用Beeline Shell拒绝用户匿名的Hive权限

[英]Hive permission denied for user anonymous using beeline shell

I created a 3 node Hadoop cluster with 1 namenode and 2 datanode. 我创建了一个具有1个namenode和2个datanode的3节点Hadoop集群。

I can perform a read/write query from Hive shell, but not beeline. 我可以从Hive Shell执行读/写查询,但不能执行beeline。

I found many suggestions and answers related to this issue. 我发现了许多与此问题相关的建议和答案。
In every suggestion it was mentioned to give the permission for the userX for each individual table. 在每个建议中都提到要为每个单独的表授予userX权限。
But I don't know how to set the permission for an anonymous user once and for all. 但是我不知道如何一劳永逸地为匿名用户设置权限。

Why I am getting the user anonymous while accessing the data from beeline or from a Java program? 为什么在从直线或Java程序访问数据时让用户匿名?

I am able to read the data from the both beeline shell and using Java JDBC connection. 我既可以从beeline外壳读取数据,也可以使用Java JDBC连接读取数据。
But I can't insert the data in the table. 但是我不能在表中插入数据。

This is my jdbc connection : jdbc:hive2://hadoop01:10000. 这是我的jdbc连接:jdbc:hive2:// hadoop01:10000。

Below is the error i am getting while on insert request: 以下是我在插入请求时遇到的错误:

Permission denied: user=anonymous, access=WRITE, inode="/user/hive/warehouse/test_log/.hive-staging_hive_2017-10-07_06-54-36_347_6034469031019245441-1":hadoop:supergroup:drwxr-xr-x 权限被拒绝:user =匿名,access = WRITE,inode =“ / user / hive / warehouse / test_log / .hive-staging_hive_2017-10-07_06-54-36_347_6034469031019245441-1”:hadoop:supergroup:drwxr-xr-x

Beeline syntax is 直线语法为

beeline -n username -u "url"

I assume you are missing the username. 我认为您缺少用户名。 Also, no one but the hadoop user has WRITE access to that table anyway 另外,除了hadoop用户以外,其他任何人都没有对该表的WRITE访问权限

If you don't have full control over the table permissions, you can try relocating the staging directory with the setting hive.exec.stagingdir 如果您不能完全控制表权限,则可以尝试使用设置hive.exec.stagingdir来重新定位登台目录

If no database is specified in the connection URL to connect, like 如果在连接URL中未指定要连接的数据库,例如

jdbc:hive2://hadoop01:10000/default JDBC:hive2:// hadoop01:10000 /默认

then beeline connects to the database DEFAULT , and while inserting the data into the table - first the data is loaded to a temporary table in default database and then loaded to the actual table. 然后beeline连接到数据库DEFAULT ,并在将数据插入表中时-首先将数据加载到默认数据库中的临时表中,然后再加载到实际表中。

So, you need to give the user access to the DEFAULT database also, or you can connect to the databases where you have access to. 因此,您还需要授予用户访问DEFAULT数据库的权限,或者可以连接到您有权访问的数据库。

jdbc:hive2://hadoop01:10000/your_db JDBC:hive2:// hadoop01:10000 / your_db

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM