设为首页 加入收藏

TOP

hadoop搭建四个配置文件(core-site.xml hdfs-site.xml mapred-site.xml yarn-site.xml )的简单介绍
2019-05-12 00:41:44 】 浏览:127
Tags:hadoop 搭建 配置 文件 core-site.xml hdfs-site.xml mapred-site.xml yarn-site.xml 简单 介绍

hadoop下载地址
http://archive.cloudera.com/cdh5/cdh/5/hadoop-2.6.0-cdh5.15.0.tar.gz

解压后设置环境变量

一 、core-site.xml

<configuration>
       <!--指定namenode的地址-->
   <property>
               <name>fs.defaultFS</name>
               <value>hdfs://DEV2:8020</value>
   </property>
   <!--用来指定使用hadoop时产生文件的存放目录-->
   <property>
            <name>hadoop.tmp.dir</name>
            <value>file:/data/hadoop/hadoop-2.6.0/tmp</value> 
   </property>
       <!--用来设置检查点备份日志的最长时间-->
       <name>fs.checkpoint.period</name> 
       <value>3600</value>
</configuration>

二 、hdfs-site.xml

<configuration>
    <!--指定hdfs保存数据的副本数量-->
    <property>
            <name>dfs.replication</name>
            <value>2</value>
    </property>
    <!--指定hdfs中namenode的存储位置-->
    <property>
             <name>dfs.namenode.name.dir</name> 
             <value>file:/data/hadoop/hadoop-2.6.0/tmp/dfs/name</value>
    </property>
    <!--指定hdfs中datanode的存储位置-->
    <property>
             <name>dfs.datanode.data.dir</name>
             <value>file:/data/hadoop/hadoop-2.6.0/tmp/dfs/data</value>
    </property>

</configuration>

进入HADOOPHOME/binnamenode./hdfsnamenodeformatHADOOP_HOME/bin 进行namenode格式化 `./hdfs namenode -format` 进入HADOOP_HOME/sbin 启动hdfs
./start-dfs.sh
http://dev2:50070 查看hadoop url

三、 mapred-site.xml

<configuration>
<!--告诉hadoop以后MR(Map/Reduce)运行在YARN上-->
        <property>
              <name>mapreduce.framework.name</name>
              <value>yarn</value>
       </property>
</configuration>

四、 yarn-site.xml

<configuration>
        <!--nomenodeManager获取数据的方式是shuffle-->
        <property>
                <name>yarn.nodemanager.aux-services</name>
                <value>mapreduce_shuffle</value>
        </property>
       <!--指定Yarn的老大(ResourceManager)的地址-->     
    <property>
            <name>yarn.resourcemanager.hostname</name>
            <value>master</value>
    </property> 
    <property>
    	<name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>
    	<value>org.apache.hadoop.mapred.ShuffleHandler</value>
	</property>
    <!--Yarn打印工作日志-->    
    <property>    
        <name>yarn.log-aggregation-enable</name> 
        <value>true</value>    
    </property>

<configuration>

进入$HADOOP_HOME/sbin 启动yarn
./start-yarn.sh
http://dev2:8088/cluster 查看hadoop信息
运行mapreduce例子
hadoop jar $HADOOP_HOME/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.6.0-cdh5.15.0.jar pi 2 3

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇通过 spring 容器内建的 profile .. 下一篇爬虫学习之18:使用selenium和chr..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目