码迷,mamicode.com
首页 > 其他好文 > 详细

熟悉常用的HDFS操作

时间:2018-04-27 02:37:24      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:python   创建   local   删除   linux   文件系统   mkdir   使用   一个   

1.在本地Linux文件系统的“/home/hadoop/”目录下创建一个文件txt,里面可以随意输入一些单词.

mkdir hadoop
cd hadoop
touch test.txt
gedit test.txt

2.在本地查看文件位置(ls)

ls -al

3.在本地显示文件内容

cat test.txt

4.使用命令把本地文件系统中的“txt”上传到HDFS中的当前用户目录的input目录下。、

cd /usr/local/hadoop
./sbin/start-dfs.sh
./bin/hdfs dfs -mkdir input
./bin/hdfs dfs -put ~/hadoop/test.txt input

5.查看hdfs中的文件(-ls)

./bin/hdfs dfs -ls

6.显示hdfs中该的文件内容

./bin/hdfs dfs -cat input/test.txt
  

 7.删除本地的txt文件并查看目录

rm -r ~/hadoop/test.txt

8.从hdfs中将txt下载地本地原来的位置。

cd /usr/local/hadoop
./sbin/start-dfs.sh
./bin/hdfs dfs -get input/test.txt ~/hadoop

9.从hdfs中删除txt并查看目录

./bin/hdfs dfs -rm -r input/test.txt
./bin/hdfs dfs -ls -R

  

 

熟悉常用的HDFS操作

标签:python   创建   local   删除   linux   文件系统   mkdir   使用   一个   

原文地址:https://www.cnblogs.com/maize/p/8955524.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!