Hadoop环境如何配置 hadoop怎么配置环境变量

博主:xiaoweixiaowei 2023-01-08 条评论

这篇文章主要介绍了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:

Hadoop环境如何配置
<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环境如何配置”这篇文章对大家有帮助,同时也希望大家多多支持云,关注云行业资讯频道,更多相关知识等着你来学习!

The End

发布于:2023-01-08,除非注明,否则均为 主机评测原创文章,转载请注明出处。