zoukankan      html  css  js  c++  java
  • 熟悉常用的hdfs操作

    编程实现以下指定功能,并利用Hadoop提供的Shell命令完成相同任务:
    在本地Linux文件系统的“/home/hadoop/”目录下创建一个文件txt,里面可以随意输入一些单词.

    cd /home/hadoop

    touch news.txt

    ./bin/hdfs dfs -mkdir -p /home/hadoop

    ./bin/hdfs dfs -touchz news.txt

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

    ./bin/hdfs dfs -ls
    在本地显示文件内容

    cat news.txt

    ./bin/hdfs dfs -cat news.txt
    使用命令把本地文件系统中的“txt”上传到HDFS中的当前用户目录的input目录下。

    ./bin/hdfs dfs -put news.txt input
    查看hdfs中的文件(-ls)

    ./bin/hdfs dfs -ls

    ./bin/hdfs dfs -ls input
    显示hdfs中该的文件内容

    ./bin/hdfs dfs -cat news.txt
    删除本地的txt文件并查看目录

    cd /home/hadoop

    rm news.txt

    ls /home/hadoop
    从hdfs中将txt下载地本地原来的位置。

    ./bin/hdfs dfs -get news.txt /home/hadoop
    从hdfs中删除txt并查看目录

    ./bin/hdfs dfs -rm news.txt

    ./bin/hdfs  dfs -ls input

  • 相关阅读:
    第十二次作业
    Beta 冲刺(7/7)
    Beta 冲刺(6/7)
    Beta 冲刺(5/7)
    Beta 冲刺(4/7)
    Beta 冲刺(3/7)
    Beta 冲刺(2/7)
    第十次作业
    Beta 冲刺(1/7)
    福大软工 · 最终作业
  • 原文地址:https://www.cnblogs.com/cairuiqi/p/8944128.html
Copyright © 2011-2022 走看看