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

sachin
  • 379
  • 3
  • 16

2 Answers2

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

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • 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' – sachin Oct 09 '17 at 06:48
  • Probably, again, `user=anonymous` doesn't have permissions to the destination table – OneCricketeer Oct 09 '17 at 15:03
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