我正在尝试导入数据(带有两列的简单文件,int和string),表格看起来是:
hive> describe test;
id int
name string
当我尝试导入时:
hive> load data inpath '/user/test.txt' overwrite into table test;
Loading data to table default.test
rmr: org.apache.hadoop.security.AccessControlException: Permission denied: user=hadoop, access=ALL, inode="/user/hive/warehouse/test":hive:hadoop:drwxrwxr-x
Failed with exception org.apache.hadoop.security.AccessControlException: Permission denied: user=hadoop, access=WRITE, inode="/user/hive/warehouse/test":hive:hadoop:drwxrwxr-x
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask
看起来用户hadoop拥有所有权限,但仍然无法加载数据,但我能够创建表。 怎么了?
答案 0 :(得分:4)
Hive使用Metastore作为其元数据。所有表定义都在其中创建,但实际数据存储在 hdfs 中。目前,hive权限和 hdfs 权限完全不同。他们是无关的。您有几种解决方法:
创建数据库:
create database hadoop;
并使用正确的权限在 hdfs 中创建所需的目录
hdfs dfs -mkdir /user/hive/warehouse/hadoop.db;
hdfs dfs -chown hadoop:hive /user/hive/warehouse/hadoop.db
hdfs dfs -chmod g+w /user/hive/warehouse/hadoop.db
当然,您应该启用hive.metastore.client.setugi=true
和hive.metastore.server.setugi=true
。这些参数指示当前shell用户下的hive执行作业(看起来这些参数已经启用,因为配置单元无法创建目录)。
答案 1 :(得分:2)
这个问题是因为语法。
生成表格的格式应与输入文件格式类似。
答案 2 :(得分:0)
是的,这是HDFS中目标目录的权限错误。一种对我有用的方法:
hadoop fs -chmod [-R] nnn / problem / table / directory
可能必须以超级用户身份运行,具体取决于您的设置。使用-R选项将新权限应用于目录中的所有内容。选择nnn以适合您的系统。