hdfs 及 yarn shell 操作

hdfs 操作

上传文件

-moveFromLocal 从本地剪切到 hdfs
$ hadoop fs -moveFromLocal ./test.txt /test

-copyFromLocal 从本地复制到 hdfs
$ hadoop fs -copyFromLocal ./test.txt /test

-put 等同于 copyFromLocal
$ hadoop fs -put ./test.txt /test

-appendToFile 向已经存在的文件末尾追加
$ hadoop fs -appendToFile ./test1.txt /test/test.txt

下载文件

-copyToLocal 从 hdfs 复制到本地
$ hadoop fs -copyToLocal /test/test.txt ./

-get 等同于 copyToLocal
$ hadoop fs -get /test/test.txt ./

其他

-ls 显示目录信息
$ hadoop fs -ls /

-cat 查看文件内容
$ hadoop fs -cat /test/test.txt

-chmod -chown 修改文件权限
$ hadoop fs -chmod 777 /test/test.txt
$ hadoop fs -chown daidai:daidai /test/test.txt

-mkdir 创建目录
$ hadoop fs -mkdir /input

-cp 从 hdfs 上复制文件到另外目录中(hdfs)
$ hadoop fs -cp /test/test.txt /input

-mv 在 hdfs 中移动目录
$ hadoop fs -mv /test/test.txt /test1/

-tail 显示一个文件末尾 1kb 的数据
$ hadoop fs -tail /test/test.txt

-rm 删除文件或文件夹 -r 递归删除
$ hadoop fs -rm /test/test.txt
$ hadoop fs -rm -r /test

-du 统计文件夹的大小
$ hadoop fs -du /test

yarn 操作

提交任务
$ hadoop jar hadoop-mapreduce-examples-3.1.3.jar wordcount /input /output

列出所有 application
$ yarn application -list

根据 application 状态过滤(ALL、NEW、NEW_SAVING、SUBMITTED、ACCEPTED、RUNNING、FINISHED、FAILED、KILLED)
$ yarn application -list -appStates FINISHED

终止 application
$ yarn application -kill application_1612597921195_0001

查看任务 log
$ yarn logs -applicationId application_1612597921195_0001

查看所有 node 节点信息
$ yarn node -list -all

查看队列信息
$ yarn queue -status <QueueName>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值