Hadoop环境配置

    Hadoop环境安装完之后需要进行相应的配置

    Hadoop组件通过XML来配置,core-site.xml用于配置Common组件的属性,hdfs-site.xml文件用于配置HDFS属性,mapred-site.xml文件用于配置MapReduce属性,hdoop支持独立模式、伪分布模式、全分布模式,在不同模式下,各属性的配置:

组件 属性 独立模式 伪分布模式 全分布模式
common fs.default.name file:///(默认) hdfs://localhost/ hdfs://namenode
hdfs dfs.replication N/A 1 3
mapreduce mapred.job.tracker(hadoop2不用配置) local(默认) localhost:8021

jobtracker:8021    

    hadoop日志配置:在hadoop-env.sh中添加export HADOOP_LOG_DIR=/usr/lib/hadoop/logs

    我hadoop2的配置如下:

    core-site.xml

    

<configuration>
        <property>
                <name>fs.default.name</name>
                <value>hdfs://localhost/</value>
        </property>
        <property>
                <name>hadoop.tmp.dir</name>
                <value>/usr/lib/hadoop/tmp/</value>
        </property>
</configuration>

    hdfs-site.xml:

    

<configuration>
        <property>
                <name>dfs.default.name</name>
                <value>/usr/lib/hadoop/logs/</value>
        </property>
        <property>
                <name>dfs.replication</name>
                <value>1</value>
        </property>
        <property>
                <name>dfs.permissions</name>
                <value>false</value>
        </property>
</configuration>

    mapred-site.xml:

    

<configuration>
        <property>
                <name>mapreduce.framework.name</name>
                <value>Yarn</value>
        </property>
</configuration>

    yarn-site.xml:

    

<configuration>
        <property>
                <name>yarn.resourcemanager.resource-tracker.address</name>
                <value>localhost:8990</value>
        </property>
        <property>
                <name>yarn.resourcemanager.scheduler.address</name>
                <value>localhost:8991</value>
        </property>
        <property>
                <name>yarn.resourcemanager.scheduler.class</name>
                <value>org.apache.hadoop.yarn.server.resourcemanage.scheduler.capacity.CapacityScheduler</value>
        </property>
        <property>
                <name>yarn.resourcemanager.address</name>
                <value>localhost:8993</value>
        </property>
        <property>
                <name>yarn.nodemanager.local-dirs</name>
                <value>/usr/lib/hadoop/tmp/node</value>
        </property>
        <property>
                <name>yarn.nodemanager.address</name>
                <value>localhost:8994</value>
        </property>
        <property>
                <name>yarn.nodemanager.resource.memory-mb</name>
                <value>102040</value>
        </property>
        <property>
                <name>yarn.nodemanager.remote-app-log-dir</name>
                <value>/usr/lib/hadoop/tmp/app-logs</value>
        </property>
        <property>
                <name>yarn.nodemanager.log-dirs</name>
                <value>/usr/lib/hadoop/tmp/node</value>
        </property>
        <property>
                <name>yarn.nodemanager.aux-services</name>
                <value>mapreduce_shuffle</value>
        </property>
</configuration>

    slaves:

localhost

    完事之后执行hadoop namenode -fromat 格式化hdfs文件系统。

    

你可能感兴趣的:(Hadoop环境配置)