hive中创建新table时候出现如下类似错误:
Moving data to: hdfs://hadoop0:9000/hive/hmbbs_pv_2013_05_30
Failed with exception Unable to rename: hdfs://hadoop0:9000/tmp/hive-root/hive_2015-05-11_14-03-48_326_1958300989754494522/-ext-10001 to: hdfs://hadoop0:9000/hive/hmbbs_pv_2013_05_30
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask
仔细查看,原因是因为hive仓库中没有创建顶级目录/hive/,这样你如果想创建表的时候(对应hdfs中的文件目录),就会报类似上面的错误,这个顶级目录是依据你自己的配置,位置在hive-site.xml中,属性如下:
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/hive</value>
<description>location of default database for the warehouse</description>
</property>
当hive没有自动在hdfs中创建顶级目录的时候,就会报如上的错误,这时你就需要手动创建或者加上如下属性的配置就可以解决:
<property>
<name>hive.insert.into.multilevel.dirs</name><value>true</value>
<description>
create the dirs
</description>
</property>