如何解决错误“文件:/user/hive/warehouse/records不是目录或无法创建目录"? [英] How can I solve the error "file:/user/hive/warehouse/records is not a directory or unable to create one"?

查看:763
本文介绍了如何解决错误“文件:/user/hive/warehouse/records不是目录或无法创建目录"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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/ 

Hive Wiki页面

这篇关于如何解决错误“文件:/user/hive/warehouse/records不是目录或无法创建目录"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆