Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

insert in HIVE failing

avatar
Super Collaborator

I am connected to HIVE using hadoop user which I created as Admin but I am still getting errors while trying to insert .

0: jdbc:hive2://SecondaryMaster:10000> INSERT INTO customers (id, firstname, lastname) VALUES (1, 'John', 'Smith'); INFO : Tez session hasn't been created yet. Opening session ERROR : Failed to execute tez graph. org.apache.hadoop.security.AccessControlException: Permission denied: user=hadoop, access=WRITE, inode="/user/hadoop":hdfs:hdfs:drwxr-xr-x

1 ACCEPTED SOLUTION

avatar
Master Guru

@Sami Ahmad you are inserting data using user hadoop into directory /user/hadoop. to fix this provide user hadoop permission to write to file directory /user/hadoop. You can also simple add user hadoop to linux group hdfs. then all permissions group hdfs has will be inheritried by users within the group. let me know if you need more details.

View solution in original post

16 REPLIES 16

avatar
Master Guru

@Sami Ahmad you are inserting data using user hadoop into directory /user/hadoop. to fix this provide user hadoop permission to write to file directory /user/hadoop. You can also simple add user hadoop to linux group hdfs. then all permissions group hdfs has will be inheritried by users within the group. let me know if you need more details.

avatar
Master Guru

@Sami Ahmad you can change the owner of /user/hadoop folder by issuing this command

hdfs dfs -chown -R hadoop /user/hadoop

or hadoop fs -chown -R hadoop /user/hadoop

Do the above command as user hdfs.

avatar
Master Guru

@Sami Ahmad Why are you change the core-site.xml? you need to update the permissions on the directory which should solve you issue as i have identified. it is trying to access that directory as it may be the default directory based on what is set on your hive.metastore.warehouse.dir. I suggest you update the file permissions and revert any changes on core-site.xml. Post what happens after you have done this.

avatar
Super Collaborator

hi Manjee how can I change the permission of a directory that does not exist?

avatar
Super Collaborator

[hdfs@ip-172-31-11-180 ~]$ hdfs dfs -chown -R hadoop /user/hadoop chown: `/user/hadoop': No such file or directory [hdfs@ip-172-31-11-180 ~]$

avatar
Rising Star

@Sami Ahmad, The permissions on your /user/hadoop HDFS directory are incorrect. You need to run this command to change the ownership of the HDFS directory:

hdfs dfs -chown hadoop:hdfs /user/hadoop

The error message shows you the current permissions on the /user/hadoop HDFS directory along with the type of access the process is trying to perform. Changing the /user/hadoop HDFS directory's owner using the above command should get you going again.

ERROR : Failed to execute tez graph. org.apache.hadoop.security.AccessControlException: Permission denied: user=hadoop, access=WRITE, inode="/user/hadoop":hdfs:hdfs:drwxr-xr-x

avatar
Super Collaborator

but why its accessing /user/hadoop ? I don't even have this directory

[hdfs@ip-172-31-11-180 ~]$ hdfs dfs -ls /user Found 11 items -rw-r--r-- 3 hdfs hdfs 124 2016-04-28 17:42 /user/a.log drwx------ - accumulo hdfs 0 2016-04-28 14:57 /user/accumulo drwxrwx--- - ambari-qa hdfs 0 2016-05-04 11:53 /user/ambari-qa -rw-r--r-- 3 hdfs hdfs 124 2016-04-28 17:43 /user/b.log drwxr-xr-x - hcat hdfs 0 2016-04-28 14:57 /user/hcat drwxr-xr-x - hdfs hdfs 0 2016-05-04 12:02 /user/hdfs drwx------ - hive hdfs 0 2016-05-04 15:39 /user/hive drwxrwxr-x - oozie hdfs 0 2016-04-28 14:57 /user/oozie drwxrwxr-x - spark hdfs 0 2016-04-28 14:55 /user/spark [hdfs@ip-172-31-11-180 ~]$

avatar
Super Collaborator

I saw this on web and after the following change the error has also changed .

"For me it was solved by changing the address that the service was listening on in /etc/hadoop/conf/core-sitse.xml. Mine was previously listening on "localhost:8020." (127.0.0.1)

<configuration> <property> <name>fs.defaultFS</name> <value>hdfs://0.0.0.0:8020</value> </property>

&& then bounce the service with hadoop "

NOW THE ERROR I GET IS :

0: jdbc:hive2://SecondaryMaster:10000> INSERT INTO customers (id, firstname, lastname) VALUES (1, 'John', 'Smith'); INFO : Tez session hasn't been created yet. Opening session ERROR : Failed to execute tez graph. org.apache.hadoop.security.AccessControlException: Permission denied: user=INSERT INTO customers (id, firstname, lastnaALUES (1, 'John', 'Smith');, access=WRITE, inode="/user/INSERT INTO customers (id, firstname, lastname) VALUES (1, 'JohSmith');":hdfs:hdfs:drwxr-xr-x

avatar
Super Collaborator

also shall I put the change that I made in core-site.xml file back ?