Hive permission denied for user anonymous using beeline shell
Asked Answered
P

3

6

I created a 3 node Hadoop cluster with 1 namenode and 2 datanode.

I can perform a read/write query from Hive shell, but not 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.
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?

I am able to read the data from the both beeline shell and using Java JDBC connection.
But I can't insert the data in the table.

This is my jdbc connection : 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

Pavyer answered 6/10, 2017 at 12:57 Comment(2)
What is your JDBC connection URL? Also you may add actual error in above question.Dundee
@Dundee i have edits my post . I have included the connection url and the error message.Pavyer
L
10

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

If you don't have full control over the table permissions, you can try relocating the staging directory with the setting hive.exec.stagingdir

Lobito answered 7/10, 2017 at 14:52 Comment(2)
I tried to change the directory of staging , But then hive starts giving the error 'Insert overwrite query failing with Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask'Pavyer
Probably, again, user=anonymous doesn't have permissions to the destination tableLobito
T
0

If no database is specified in the connection URL to connect, like

jdbc:hive2://hadoop01:10000/default

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.

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.

jdbc:hive2://hadoop01:10000/your_db

Terryl answered 3/3, 2018 at 19:52 Comment(0)
F
0

You need to create the following hdfs directory:/user/hive/warehouse/test_log to get rid of the above error.

Facility answered 4/3 at 19:30 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Maccarone

© 2022 - 2024 — McMap. All rights reserved.