Hadoop之HDFS操作

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/GoSaint/article/details/86746635

其实本篇文章是我Hadoop环境安装的续篇。在Hadoop本地开发入门这篇文章中,我的输入输出文件全部在本地,并没有上传到HDFS上面。今天就是HDFS的操作。

1 配置core-site.xml

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
   <property>
        <name>fs.defaultFS</name>
        <value>hdfs://localhost:9000/</value>
    </property>

    <property>
        <name>hadoop.tmp.dir</name>
        <value>file:///D:/hadoop-info/hadoop-2.8.1/data/tmp</value>
    </property>
</configuration>


2 配置运行参数:
在这里插入图片描述

3 在HDFS上新建input文件夹:

D:\hadoop-info\hadoop-2.8.1\sbin>hadoop fs -mkdir hdfs://localhost:9000/input

4 往input文件夹里面上传readme.txt

D:\hadoop-info\hadoop-2.8.1\sbin>hadoop fs -put D:\hdfs\readme.txt hdfs://localhost:9000/input

5 运行主程序

6 查看output输出:

D:\hadoop-info\hadoop-2.8.1\sbin>hadoop fs -ls hdfs://localhost:9000/output

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/GoSaint/article/details/86746635