• 【Hadoop】 2.7.3版本 hdfs 命令行使用


    1.查看HDFS下目录结构及文件

    dream361@ubuntu:~$ hdfs dfs -ls -R /

    2.创建文件目录/tmp

    dream361@ubuntu:~$ hdfs dfs -mkdir /tmp

    3.复制当前目录下a.txts到HDFS文件系统

    dream361@ubuntu:~$ hdfs dfs -put a.txt /inputFile

    4.列出/tmp目录

    dream361@ubuntu:~$ hdfs dfs -ls /tmp

    5.查看/inputFile/a.txt文件内容

    dream361@ubuntu:~$ hdfs dfs -cat /inputFile/a.txt
    Not Support zh_CN.UTF-8
    cannot output Chinese LANGUAGE

    6.删除/tmp目录

    dream361@ubuntu:~$ hdfs dfs -rm /tmp
    rm: `/tmp': Is a directory
    dream361@ubuntu:~$ hdfs dfs -rm -r /tmp
    17/02/25 19:38:25 INFO fs.TrashPolicyDefault: Namenode trash configuration: Deletion interval = 0 minutes, Emptier interval = 0 minutes.
    Deleted /tmp

    7.查看HDFS状态

    dream361@ubuntu:~$ hdfs dfsadmin -report
    Configured Capacity: 14662287360 (13.66 GB)
    Present Capacity: 7529889792 (7.01 GB)
    DFS Remaining: 7529844736 (7.01 GB)
    DFS Used: 45056 (44 KB)
    DFS Used%: 0.00%
    Under replicated blocks: 0
    Blocks with corrupt replicas: 0
    Missing blocks: 0
    Missing blocks (with replication factor 1): 0
    
    -------------------------------------------------
    Live datanodes (1):
    
    Name: 127.0.0.1:50010 (localhost)
    Hostname: localhost
    Decommission Status : Normal
    Configured Capacity: 14662287360 (13.66 GB)
    DFS Used: 45056 (44 KB)
    Non DFS Used: 7132397568 (6.64 GB)
    DFS Remaining: 7529844736 (7.01 GB)
    DFS Used%: 0.00%
    DFS Remaining%: 51.36%
    Configured Cache Capacity: 0 (0 B)
    Cache Used: 0 (0 B)
    Cache Remaining: 0 (0 B)
    Cache Used%: 100.00%
    Cache Remaining%: 0.00%
    Xceivers: 1
    Last contact: Sat Feb 25 19:41:39 PST 2017

    8.离开或进入安全模式

    dream361@ubuntu:~$ hdfs dfsadmin -safemode leave
    Safe mode is OFF
    dream361@ubuntu:~$ hdfs dfsadmin -safemode enter
    Safe mode is ON




  • 相关阅读:
    JavaEE基础(01):Servlet实现方式,生命周期执行过程
    Spring 框架基础(06):Mvc架构模式简介,执行流程详解
    Spring 框架基础(05):事务管理机制,和实现方式
    多线程搜索与排序
    mybatis的Mapper代理原理
    spring的RestTemplate使用指南
    探索CAS无锁技术
    两年Java的面试经验
    HashMap多线程并发的问题
    解析Mybaits的insert方法返回数字-2147482646的原因
  • 原文地址:https://www.cnblogs.com/zhengwenqiang/p/6804605.html
Copyright © 2020-2023  润新知