Support Questions

Find answers, ask questions, and share your expertise

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
Super Collaborator

@Sami Ahmad

Please create home directory for hadoop user in HDFS first. It seems it does not exist. Please run following commands in the given sequence and try again running your hive command:

su - hdfs
hdfs dfs -mkdir /user/hadoop
hdfs dfs -chown -R hadoop /user/hadoop
exit

avatar
Super Collaborator

I created the directory and granted permissions but now it just hangs . all services are up except knox.

[hdfs@ip-172-31-11-180 ~]$ beeline

WARNING: Use "yarn jar" to launch YARN applications. Beeline version 1.2.1.2.3.4.0-3485 by Apache Hive beeline> !connect jdbc:hive2://SecondaryMaster:10000 Connecting to jdbc:hive2://SecondaryMaster:10000 Enter username for jdbc:hive2://SecondaryMaster:10000: hadoop

Enter password for jdbc:hive2://SecondaryMaster:10000: ******

Connected to: Apache Hive (version 1.2.1.2.3.4.0-3485) Driver: Hive JDBC (version 1.2.1.2.3.4.0-3485) Transaction isolation: TRANSACTION_REPEATABLE_READ 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 INFO :

Tez session hasn't been created yet. Opening session INFO :

Tez session hasn't been created yet. Opening session

avatar
Super Collaborator

it has created the HIVE file in the newly created directory so its doing something

[hdfs@ip-172-31-11-180 ~]$ hdfs dfs -ls /user

drwxr-xr-x - hadoop hdfs 0 2016-05-04 17:14 /user/hadoop

[hdfs@ip-172-31-11-180 ~]$ hdfs dfs -ls /user/hadoop Found 1 items drwxr-xr-x - hadoop hdfs 0 2016-05-04 17:14 /user/hadoop/.hiveJars

avatar
Super Collaborator

Please exit out from hdfs user also before running the query. It seems you ran it using hdfs user instead of hadoop user.

avatar
Super Collaborator

hadoop user i used in the connect command was a user i created in Ambari , does it already get created on Linux?

i was running hdfs commands under hdfs and hive commands under hive Linux account.

please advise me on how to properly run each application .should i use a common account or indivisual accounts for each application?

avatar
Super Collaborator

I need help , HIVE still not working , INSERT command just hangs

[root@ip-172-31-11-180 ~]# su - hive [hive@ip-172-31-11-180 ~]$ id uid=501(hive) gid=502(hadoop) groups=502(hadoop) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 [hive@ip-172-31-11-180 ~]$ beeline WARNING: Use "yarn jar" to launch YARN applications. Beeline version 1.2.1.2.3.4.0-3485 by Apache Hive beeline> !connect jdbc:hive2://SecondaryMaster:10000 Connecting to jdbc:hive2://SecondaryMaster:10000 Enter username for jdbc:hive2://SecondaryMaster:10000: hadoop Enter password for jdbc:hive2://SecondaryMaster:10000: ****** Connected to: Apache Hive (version 1.2.1.2.3.4.0-3485) Driver: Hive JDBC (version 1.2.1.2.3.4.0-3485) Transaction isolation: TRANSACTION_REPEATABLE_READ 0: jdbc:hive2://SecondaryMaster:10000> INSERT INTO person (id, firstname, lastname) VALUES (1, 'John', 'Smith'); INFO : Tez session hasn't been created yet. Opening session

avatar
Super Collaborator

I can see the table definitions so it must be able to make database connection ,but insert hangs

0: jdbc:hive2://SecondaryMaster:10000> show tables; +------------+--+ | tab_name | +------------+--+ | customers | | person | +------------+--+ 2 rows selected (0.063 seconds) 0: jdbc:hive2://SecondaryMaster:10000> describe person; +------------+------------+----------+--+ | col_name | data_type | comment | +------------+------------+----------+--+ | id | int | | | firstname | string | | | lastname | string | | +------------+------------+----------+--+ 3 rows selected (0.091 seconds) 0: jdbc:hive2://SecondaryMaster:10000> INSERT INTO person (id, firstname, lastname) VALUES (1, 'John', 'Smith'); INFO : Tez session hasn't been created yet. Opening session