我必须创建/tmp和/user/hive/warehouse吗? [英] Do I have to create /tmp and /user/hive/warehouse?

查看:347
本文介绍了我必须创建/tmp和/user/hive/warehouse吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自 https://cwiki.apache.org/confluence/display/Hive/入门

正在运行Hive

Hive使用Hadoop,所以:

Hive uses Hadoop, so:

  • 您的路径中必须包含Hadoop或
  • 导出HADOOP_HOME =

此外,您必须使用下面的HDFS命令来创建/tmp和 /user/hive/warehouse(又名hive.metastore.warehouse.dir)并进行设置 chmod g + w,然后才能在Hive中创建表.

In addition, you must use below HDFS commands to create /tmp and /user/hive/warehouse (aka hive.metastore.warehouse.dir) and set them chmod g+w before you can create a table in Hive.

  $ $HADOOP_HOME/bin/hadoop fs -mkdir       /tmp
  $ $HADOOP_HOME/bin/hadoop fs -mkdir       /user/hive/warehouse
  $ $HADOOP_HOME/bin/hadoop fs -chmod g+w   /tmp
  $ $HADOOP_HOME/bin/hadoop fs -chmod g+w   /user/hive/warehouse

我不能运行两个-mkdir命令:

$ $HADOOP_HOME/bin/hadoop fs -mkdir       /tmp
mkdir: `/tmp': File exists

`/tmp'已经存在于我的Ubuntu的本地ext4文件系统中.

`/tmp' already exists on my local ext4 file system in my Ubuntu.

$ $HADOOP_HOME/bin/hadoop fs -mkdir       /user/hive/warehouse
mkdir: `/user/hive/warehouse': No such file or directory

在我的Ubuntu的本地ext4文件系统中没有/usr/hive/warehouse.

There is no /usr/hive/warehouse in my local ext4 file system in my Ubuntu.

那么运行-mkdir创建两个目录的目的是什么?

So what is the purpose of running -mkdir to create the two directories?

推荐答案

mkdir:`/tmp':文件存在

mkdir: `/tmp': File exists

此文件夹已存在于hdfs中.因此,在运行mkdir命令时出现文件存在"错误.

This folder is already present in hdfs. So you are getting 'File exists' error while running mkdir command.

您可以使用列表命令进行检查: hadoop fs -ls/

You can check with list command: hadoop fs -ls /

mkdir:`/user/hive/warehouse':没有这样的文件或目录

mkdir: `/user/hive/warehouse': No such file or directory

mkdir命令创建新目录,但是不创建父目录.如果路径中不存在任何父目录,则会收到无此文件或目录"错误.在这种情况下,用户"或配置单元"目录都不存在.

mkdir command creates new directory however does not create parent directories. If any of the parent directories don’t exist in the path, you will get 'No such file or directory' error. In this case either 'user' or 'hive' directory does not exists.

您可以使用列表命令进行检查: hadoop fs -ls/user

You can check with list command: hadoop fs -ls /user

使用'-p'选项运行'mkdir'命令会创建所有丢失的父目录.

Running 'mkdir' command with '-p' option creates all missing parent directories.

hadoop fs -mkdir -p /user/hive/warehouse 

'/tmp'和'/user/hive/warehouse'目录均在hdfs文件系统中创建.您无法使用本地文件系统命令查看这些文件夹.

Both '/tmp' and '/user/hive/warehouse' directories are created in hdfs file system. You cannot see these folders using local file system commands.

`/tmp'已经存在于我的Ubuntu的本地ext4文件系统中.

`/tmp' already exists on my local ext4 file system in my Ubuntu.

此/tmp文件夹由您的操作系统维护,并用于保存临时文件.与hdfs无关.

This /tmp folder is maintained by your operating system and used to hold temporary files. Not related to hdfs.

要列出hdfs中的文件夹,

To list folders in hdfs,

hadoop fs -ls /user
hadoop fs -ls /
hadoop fs -ls /user/hive/

这篇关于我必须创建/tmp和/user/hive/warehouse吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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