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>
       
   <property>
               <name>fs.defaultFSname>
               <value>hdfs://DEV2:8020value>
   property>
   
   <property>
            <name>hadoop.tmp.dirname>
            <value>file:/data/hadoop/hadoop-2.6.0/tmpvalue> 
   property>
       
       <name>fs.checkpoint.periodname> 
       <value>3600value>
configuration>

二 、hdfs-site.xml

<configuration>
    
    <property>
            <name>dfs.replicationname>
            <value>2value>
    property>
    
    <property>
             <name>dfs.namenode.name.dirname> 
             <value>file:/data/hadoop/hadoop-2.6.0/tmp/dfs/namevalue>
    property>
    
    <property>
             <name>dfs.datanode.data.dirname>
             <value>file:/data/hadoop/hadoop-2.6.0/tmp/dfs/datavalue>
    property>

configuration>

进入 H A D O O P H O M E / b i n 进 行 n a m e n o d e 格 式 化 ‘ . / h d f s n a m e n o d e − f o r m a t ‘ 进 入 HADOOP_HOME/bin 进行namenode格式化 `./hdfs namenode -format` 进入 HADOOPHOME/binnamenode./hdfsnamenodeformatHADOOP_HOME/sbin 启动hdfs
./start-dfs.sh
http://dev2:50070 查看hadoop url

三、 mapred-site.xml

<configuration>

        <property>
              <name>mapreduce.framework.namename>
              <value>yarnvalue>
       property>
configuration>

四、 yarn-site.xml

<configuration>
        
        <property>
                <name>yarn.nodemanager.aux-servicesname>
                <value>mapreduce_shufflevalue>
        property>
            
    <property>
            <name>yarn.resourcemanager.hostnamename>
            <value>mastervalue>
    property> 
    <property>
    	<name>yarn.nodemanager.aux-services.mapreduce.shuffle.classname>
    	<value>org.apache.hadoop.mapred.ShuffleHandlervalue>
	property>
        
    <property>    
        <name>yarn.log-aggregation-enablename> 
        <value>truevalue>    
    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

你可能感兴趣的:(Hadoop,CDH)