TDH Hive 分區 拋出無權限異常
異常日誌
SQL 錯誤 [20388] [42000]: COMPILE FAILED: Internal error HiveAccessControlException: [Error 20388] Permission denied: Principal [name=hive, type=USER] does not have following privileges for operation ALTERTABLE_ADDPARTS [[OBJECT OWNERSHIP] on Object [type=DFS_URI, name=xxxxxxxxxxxxxx]]
java.sql.SQLException: COMPILE FAILED: Internal error HiveAccessControlException: [Error 20388] Permission denied: Principal [name=hive, type=USER] does not have following privileges for operation ALTERTABLE_ADDPARTS [[OBJECT OWNERSHIP] on Object [type=DFS_URI, name=xxxxxxxxxx]]
COMPILE FAILED: Internal error HiveAccessControlException: [Error 20388] Permission denied: Principal [name=hive, type=USER] does not have following privileges for operation ALTERTABLE_ADDPARTS [[OBJECT OWNERSHIP] on Object [type=DFS_URI, name=/xxxxxxxxxxxxx]]
執行過程中出現User hive is not a super user
[root@node ~]# hdfs dfs -chown hive:hive xxxx
2019-12-16 11:26:47,085 INFO util.KerberosUtil: Using principal pattern: HTTP/_HOST
chown: changing ownership of '/xxx/xxx/xxx': User hive is not a super user (non-super user cannot change owner).
需要配置hadoop的user環境變量
export HADOOP_USER_name=hdfs
解決方法
需要將hdfs文件制定到hive:hive的用戶組下
hdfs dfs -chown -R hive:hive /xxx/xxx
再次執行alter table xxx add partition 問題解決