5.hadoop常用命令

1. 单独启动和关闭hadoop服务

  1. 启动名称节点

    #hadoop-daemon.sh start namenode
  2. 启动数据节点

    #hadoop-daemons.sh start datanode slave
  3. 启动secondarynamenode

    #hadoop-daemon.sh start secondarynamenode
  4. 启动resourcemanager

    #yarn-daemon.sh start resourcemanager
  5. 启动nodemanager

    #bin/yarn-daemons.sh start nodemanager
  6. 停止数据节点

    #hadoop-daemons.sh stop datanode

2. 常用的命令

  1. 创建目录

    #hdfs dfs -mkdir /input
  2. 查看

    #hdfs dfs  -ls
  3. 递归查看

    #hdfs dfs ls -R
  4. 上传

    #hdfs dfs -put 
  5. 下载

    #hdfs dfs -get 
  6. 删除

    #hdfs dfs -rm
  7. 从本地剪切粘贴到hdfs

    #hdfs fs -moveFromLocal /input/xx.txt /input/xx.txt
  8. 从hdfs剪切粘贴到本地

    #hdfs fs -moveToLocal /input/xx.txt /input/xx.txt
  9. 追加一个文件到另一个文件到末尾

    #hdfs fs -appedToFile ./hello.txt /input/hello.txt
  10. 查看文件内容

    #hdfs fs -cat /input/hello.txt
  11. 显示一个文件到末尾

    #hdfs fs -tail /input/hello.txt
  12. 以字符串的形式打印文件的内容

    #hdfs fs -text /input/hello.txt
  13. 修改文件权限

    #hdfs fs -chmod 666 /input/hello.txt
  14. 修改文件所属

    #hdfs fs -chown liuyao.liuyao  /input/hello.txt
  15. 从本地文件系统拷贝到hdfs里

    #hdfs fs -copyFromLocal /input/hello.txt /input/
  16. 从hdfs拷贝到本地

    #hdfs fs -copyToLocal /input/hello.txt /input/
  17. 从hdfs到一个路径拷贝到另一个路径

    #hdfs fs -cp /input/xx.txt /output/xx.txt
  18. 从hdfs到一个路径移动到另一个路径

    #hdfs fs -mv /input/xx.txt /output/xx.txt
  19. 统计文件系统的可用空间信息

    #hdfs fs -df -h /
  20. 统计文件夹的大小信息

    #hdfs fs -du -s -h /
  21. 统计一个指定目录下的文件节点数量

    #hadoop  fs -count /aaa
  22. 设置hdfs的文件副本数量

    #hadoop fs -setrep 3 /input/xx.txt

转载于:https://www.cnblogs.com/liu-yao/p/5-hadoop-mingling.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值