博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
第三章 熟悉常用的HDFS操作
阅读量:7200 次
发布时间:2019-06-29

本文共 653 字,大约阅读时间需要 2 分钟。

编程实现以下指定功能,并利用Hadoop提供的Shell命令完成相同任务:

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

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

在本地显示文件内容

mkdir hadoopcd hadooptouch dw777.txtgedit dw777.txt

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

./sbin/start-dfs.sh    ./bin/hdfs dfs -mkdir -p /user/hadoop    ./bin/hdfs dfs -mkdir input    ./bin/hdfs dfs -put ./test.txt input

查看hdfs中的文件(-ls)

./bin/hdfs dfs -ls /input

显示hdfs中该的文件内容

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

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

cd hadoop rm -r 123.txtls -al

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

./bin/hdfs dfs -get /input/123.txt ~/hadoop

从hdfs中删除txt并查看目录

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

 

转载于:https://www.cnblogs.com/swxvico/p/8934106.html

你可能感兴趣的文章
线程的状态转换图
查看>>
VMware vSphere 5.0 五大改变
查看>>
spring注解性的事物@Transactional不起作用
查看>>
使用aulayout自适应uitableviewcell高度
查看>>
让我们一起Go(三)
查看>>
简单的Linux数据备份方案
查看>>
linux postgresql 安装配置详解
查看>>
一个监控tomcat运行的脚本分享
查看>>
电脑可以上网但网络连接显示感叹号
查看>>
我的友情链接
查看>>
MaxCompute用户初体验
查看>>
阿里云十年再出发,边缘计算已启航
查看>>
代理服务器与网络地址转换NAT
查看>>
我的友情链接
查看>>
SQL Server 镜像
查看>>
NFS-网络文件系统配置
查看>>
Apache Thrift入门1-架构&介绍
查看>>
rabbitmq集群是否出现脑裂监控
查看>>
java synchronized关键字的用法--对象锁和类锁
查看>>
任务3 SQL语句相关问题
查看>>