如何在 Ubuntu 中将文件上传到 HDFS
How to upload file to HDFS in Ubuntu
我是 hadoop 新手,在 ubuntu 14.04 LTS
中使用单节点 hadoop 1.2.1
。我想将文件上传到 hadoop 执行,但我不知道如何使用 copyFromLocal
命令。请告诉我如何上传文件
我的源文件路径 "/home/saurabh/downloads/examples.jar"
我的 hadoop 在 /usr/local/hadoop/
hadoop fs -put /path/to/file.ext /usr/local/hadoop/
Put 命令将文件从本地系统传输到 hdfs。在下面写的行中,file.ext 将被移动到 /usr/local/hadoop
文件夹,您可以通过 运行 hadoop fs -ls /usr/local/hadoop
查看它
如果你的 hadoop 在 PATH 中,那么你可以这样做:
hadoop fs -put /home/saurabh/downloads/examples.jar /path/in/hdfs
If your hadoop is not in PATH, then you should either export HADOOP_HOME or you could also cd into the folder where you have installed hadoop and then execute the command.
你也可以这样做:
hadoop fs -copyFromLocal /home/saurabh/downloads/examples.jar /path/in/hdfs
其中 /path/in/hdfs
是您要将 HDFS 中的文件复制到的位置,假设如果您想将文件复制到 HDFS 中的 /user/saurabh
那么命令将是这样的:
hadoop fs -put /home/saurabh/downloads/examples.jar /user/saurabh
我是 hadoop 新手,在 ubuntu 14.04 LTS
中使用单节点 hadoop 1.2.1
。我想将文件上传到 hadoop 执行,但我不知道如何使用 copyFromLocal
命令。请告诉我如何上传文件
我的源文件路径 "/home/saurabh/downloads/examples.jar"
我的 hadoop 在 /usr/local/hadoop/
hadoop fs -put /path/to/file.ext /usr/local/hadoop/
Put 命令将文件从本地系统传输到 hdfs。在下面写的行中,file.ext 将被移动到 /usr/local/hadoop
文件夹,您可以通过 运行 hadoop fs -ls /usr/local/hadoop
如果你的 hadoop 在 PATH 中,那么你可以这样做:
hadoop fs -put /home/saurabh/downloads/examples.jar /path/in/hdfs
If your hadoop is not in PATH, then you should either export HADOOP_HOME or you could also cd into the folder where you have installed hadoop and then execute the command.
你也可以这样做:
hadoop fs -copyFromLocal /home/saurabh/downloads/examples.jar /path/in/hdfs
其中 /path/in/hdfs
是您要将 HDFS 中的文件复制到的位置,假设如果您想将文件复制到 HDFS 中的 /user/saurabh
那么命令将是这样的:
hadoop fs -put /home/saurabh/downloads/examples.jar /user/saurabh