熟悉常用的HDFS操作

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

  

 

转载于:https://www.cnblogs.com/maize/p/8955524.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值