前提:
上傳數據至hdfs 的/user/root/下,創建了hive的orc表,準備load數據,創建了臨時的ordertmp的textfile格式表,後面用insert overwrite進目標表。
執行load data 從/user/root/下加載數據到hive表中,報下面的權限錯誤。
0: jdbc:hive2://node01:10000> load data inpath '/user/root/order/order.txt' into table ordertmp;
INFO : Compiling command(queryId=hive_20200609152526_ab09ff14-54cf-4e3c-ac05-a47f82389b36): load data inpath '/user/root/order/order.txt' into table ordertmp
INFO : Semantic Analysis Completed
INFO : Returning Hive schema: Schema(fieldSchemas:null, properties:null)
INFO : Completed compiling command(queryId=hive_20200609152526_ab09ff14-54cf-4e3c-ac05-a47f82389b36); Time taken: 0.471 seconds
INFO : Executing command(queryId=hive_20200609152526_ab09ff14-54cf-4e3c-ac05-a47f82389b36): load data inpath '/user/root/order/order.txt' into table ordertmp
INFO : Starting task [Stage-0:MOVE] in serial mode
INFO : Loading data to table default.ordertmp from hdfs://node01:8020/user/root/order/order.txt
ERROR : FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask. org.apache.hadoop.hive.ql.metadata.HiveException: Access denied: Unable to move source hdfs://node01:8020/user/root/order/order.txt to destination hdfs://node01:8020/user/hive/warehouse/ordertmp: Permission denied: user=anonymous, access=WRITE, inode="/user/root/order":root:supergroup:drwxr-xr-x
INFO : Completed executing command(queryId=hive_20200609152526_ab09ff14-54cf-4e3c-ac05-a47f82389b36); Time taken: 0.289 seconds
Error: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask. org.apache.hadoop.hive.ql.metadata.HiveException: Access denied: Unable to move source hdfs://node01:8020/user/root/order/order.txt to destination hdfs://node01:8020/user/hive/warehouse/ordertmp: Permission denied: user=anonymous, access=WRITE, inode="/user/root/order":root:supergroup:drwxr-xr-x (state=08S01,code=1)
解決:
su hdfs
hdfs dfs -chmod -R 777 /user/root/
解決。