如何解决错误“文件:/user/hive/warehouse/records不是目录或无法创建目录"? [英] How can I solve the error "file:/user/hive/warehouse/records is not a directory or unable to create one"?
问题描述
hive> CREATE TABLE records (year STRING, temperature INT, quality INT)
> ROW FORMAT DELIMITED
> FIELDS TERMINATED BY '\t';
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:file:/user/hive/warehouse/records is not a directory or unable to create one)
如何解决该错误?
/user/hive/warehouse/
在哪里?在Ubuntu下的本地ext4文件系统中,没有/user/hive/warehouse/
这样的路径.
where is /user/hive/warehouse/
located? In my local ext4 filesystems under Ubuntu, there is no /user/hive/warehouse/
such a path.
我如何获取有关检查/user/hive/warehouse/
的信息?
How can I get information about i.e. examine /user/hive/warehouse/
?
推荐答案
在运行hive命令之前,应在hdfs文件系统中创建/user/hive/warehouse 文件夹.
You should create /user/hive/warehouse folder in hdfs file system before running hive commands.
Hive内部使用hadoop hdfs文件系统来存储数据库数据.您可以使用以下命令在hive-default.xml和/或hive-site.xml配置文件或hive终端中检查hdfs目录路径
Hive internally uses hadoop hdfs file system to store database data. You can check the hdfs directory path in hive-default.xml and/or hive-site.xml configuration file or in hive terminal, using below command
hive> set hive.metastore.warehouse.dir;
如前所述,Hive使用Hadoop,所以
As mentioned Hive uses Hadoop, so
- Hadoop必须已安装并处于运行状态
-
必须设置HADOOP_HOME环境变量
- Hadoop must be installed and running status
HADOOP_HOME environment variable must be set
export HADOOP_HOME=hadoop-install-dir
export PATH=$PATH:$HADOOP_HOME/bin
必须在hdfs文件系统中创建目录并授予对配置单元的访问权限
Directories in hdfs file system must be created and given access to hive
hadoop fs -mkdir -p /tmp
hadoop fs -mkdir -p /user/hive/warehouse
hadoop fs -chmod g+w /tmp
hadoop fs -chmod g+w /user/hive/warehouse
列出hdfs文件系统中的目录
To list directories in hdfs file system
hadoop fs -ls /user
hadoop fs -ls /
hadoop fs -ls /user/hive/
这篇关于如何解决错误“文件:/user/hive/warehouse/records不是目录或无法创建目录"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!