[Hadoop踩坑]叢集分散式環境配置

duanhao發表於2021-09-09

在配置叢集/分散式模式時,需要修改/usr/local/hadoop/etc/hadoop目錄下的配置檔案,這裡僅設定正常啟動所需的設定項,包括slaves,core-site.xml,hdfs-site.xml、yarn-site.xml、mapred-site.xml 共5個檔案。
我的環境:
Ubuntu 16.04 TLS
Hadoop 2.6.0

192.168.56.102 Master
192.168.56.105 data1
192.168.56.104 data2
192.168.56.103 data3

(1)修改檔案slaves:
sudo gedit /usr/local/hadoop/etc/hadoop/slaves
需要把所有的資料節點的主機名寫入該檔案,每行一個。

圖片描述

圖片.png


(2)修改core-site.xml:
sudo gedit /usr/local/hadoop/etc/hadoop/core-site.xml

<configuration>
        <property>
                <name>fs.defaultFS</name>
                <value>hdfs://Master:9000</value>
        </property>
        <property>
                <name>hadoop.tmp.dir</name>
                <value>file:/usr/local/hadoop/tmp</value>
                <description>Abase for other temporary directories.</description>
        </property></configuration>

(3)修改檔案hdfs-site.xml
sudo gedit /usr/local/hadoop/etc/hadoop/hdfs-site.xml

<configuration>
        <property>
                <name>dfs.namenode.secondary.http-address</name>
                <value>Master:50090</value>
        </property>
        <property>
                <name>dfs.replication</name>
                <value>3</value>
        </property>
        <property>
                <name>dfs.namenode.name.dir</name>
                <value>file:/usr/local/hadoop/tmp/dfs/name</value>
        </property>
        <property>
                <name>dfs.datanode.data.dir</name>
                <value>file:/usr/local/hadoop/tmp/dfs/data</value>
        </property></configuration>

(4)修改檔案mapred-site.xml
sudo gedit /usr/local/hadoop/etc/hadoop/mapred-site.xml

<configuration>
        <property>
                <name>mapreduce.framework.name</name>
                <value>yarn</value>
        </property>
        <property>
                <name>mapreduce.jobhistory.address</name>
                <value>Master:10020</value>
        </property>
        <property>
                <name>mapreduce.jobhistory.webapp.address</name>
                <value>Master:19888</value>
        </property></configuration>

(5)修改檔案yarn-site.xml
sudo gedit /usr/local/hadoop/etc/hadoop/yarn-site.xml

<configuration>
        <property>
                <name>yarn.resourcemanager.hostname</name>
                <value>Master</value>
        </property>
        <property>
                <name>yarn.nodemanager.aux-services</name>
                <value>mapreduce_shuffle</value>
        </property></configuration>



作者:楓雪淺語
連結:


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/1343/viewspace-2816312/,如需轉載,請註明出處,否則將追究法律責任。

相關文章