• Hadoop常用命令


    HDFS基本命令:
    hadoop fs -cmd
    cmd: 具体的操作,基本上与UNIX的命令行相同
    args:参数
    HDFS资源URI格式:
    scheme://authority/path
    scheme:协议名,file或hdfs
    authority:namenode主机名
    path:路径
    示例:hdfs://localhost:9000/user/chunk/test.txt
    假设已经在core-site.xml里配置了 fs.default.name=hdfs://localhost:9000,则仅使用/user/chunk/test.txt即可。
    hdfs默认工作目录为 /user/$USER,$USER是当前的登录用户名。
    HDFS命令示例:
    hadoop fs -mkdir /user/trunk
    hadoop fs -ls /user
    hadoop fs -lsr /user (递归的)
    hadoop fs -put test.txt /user/trunk
    hadoop fs -put test.txt . (复制到hdfs当前目录下,首先要创建当前目录)
    hadoop fs -get /user/trunk/test.txt . (复制到本地当前目录下)
    hadoop fs -cat /user/trunk/test.txt
    hadoop fs -tail /user/trunk/test.txt (查看最后1000字节)
    hadoop fs -rm /user/trunk/test.txt
    hadoop fs -help ls (查看ls命令的帮助文档)


    hadoop fs -cat '/user/hive/warehouse/ci_cuser_20141231141853691/_SUCCESS'; hadoop fs -cat '/user/hive/warehouse/ci_cuser_20141231141853691/*'>CI_CUSERE_20141231141853691.csv && echo $?

    ~/.bash_profile:每个用户都可使用该文件输入专用于自己使用的shell信息,当用户登录时,该
    文件仅仅执行一次!默认情况下,他设置一些环境变量,执行用户的.bashrc文件.


    hadoop fs -cat '$1$2/*'>$3.csv
    mv $3.csv/home/ocdc/coc

    String command = "cd "+ ciFtpInfo.getFtpPath() + " && " +hadoopPath+ "hadoop fs -cat '/user/hive/warehouse/"+listName+"/*' > " +listTableName+".csv;";

    '/home/ocdc/spark-1.2.0-oc-bin-2.3.0-cdh5.1.3/bin/beeline -u jdbc:hive2://10.1.251.98:10000 -n ocdc -p asiainfo

    tar zxvf 文件名.tar.gz
    cp 文件名1 文件名2 (复制文件)

    管理员常用命令:

    hadoop job –list  #列出正在运行的Job

    hadoop job –kill <job_id> #kill job

    hadoop fsck / #检查HDFS块状态,是否损坏

    hadoop fsck / -delete #检查HDFS块状态,删除损坏块

    hadoop dfsadmin –report #检查HDFS状态,包括DN信息

    hadoop dfsadmin –safemode enter | leave

    hadoop distcp hdfs://a:8020/xxx hdfs://b:8020/// #并行copy

  • 相关阅读:
    设计模式-观察者模式
    idea 生成 protobuf
    springboot @Autowride 注入空 调用时报Null空指针
    Netty 服务端创建过程
    git failed to push some refs to
    SPI simp
    Controller之statefulset
    Service
    Controller之deployment
    rabbitmq“ Login was refused using authentication mechanism PLAIN”
  • 原文地址:https://www.cnblogs.com/yangsy0915/p/4866936.html
Copyright © 2020-2023  润新知