1. 程式人生 > >hadoop集群部署

hadoop集群部署

name tfs 目錄 chm style mapr 獲取數據 config property

1. 目錄/opt/hadoop/etc/hadoop

core-site.xml

<configuration>
            <property>
                <name>fs.defaultFS</name>
                <value>hdfs://mip:9000</value>
            </property>
</configuration>

mip:在主節點的mip就是自己的ip,而所有從節點的mip是主節點的ip。

9000:主節點和從節點配置的端口都是9000

hdfs-site.xml

        <configuration>
            <property>
                <name>dfs.nameservices</name>
                <value>hadoop-cluster</value>
            </property>
            <property>
                <name>dfs.replication</name>
                <value>1
</value> </property> <property> <name>dfs.namenode.name.dir</name> <value>file:///data/hadoop/hdfs/nn</value> </property> <property> <name>dfs.namenode.checkpoint.dir</name> <value>file:///
data/hadoop/hdfs/snn</value> </property> <property> <name>dfs.namenode.checkpoint.edits.dir</name> <value>file:///data/hadoop/hdfs/snn</value> </property> <property> <name>dfs.datanode.data.dir</name> <value>file:///data/hadoop/hdfs/dn</value> </property> </configuration>

dfs.nameservices:在一個全分布式集群大眾集群當中這個的value要相同

mapred-site.xml

<configuration>
            <property>
      <!-指定Mapreduce運行在yarn上-->
                <name>mapreduce.framework.name</name>
                <value>yarn</value>
            </property>
</configuration>

yarn-site.xml

 <configuration>
            <!-- 指定ResourceManager的地址-->
            <property>
                <name>yarn.resourcemanager.hostname</name>
                <value>mip</value>
            </property>
            <!-- 指定reducer獲取數據的方式-->
            <property>
                <name>yarn.nodemanager.aux-services</name>
                <value>mapreduce_shuffle</value>
            </property>
            <property>
                <name>yarn.nodemanager.local-dirs</name>
                <value>file:///data/hadoop/yarn/nm</value>
            </property>
 </configuration>

創建目錄

mkdir -p /data/hadoop/hdfs/nn
mkdir -p /data/hadoop/hdfs/dn
mkdir -p /data/hadoop/hdfs/snn
mkdir -p /data/hadoop/yarn/nm

一定要設置成:chmod -R 777 /data

hdfs啟動 ./hadoop-daemon.sh start namenode

yarn啟動 ./yarn-daemon.sh start resourcemanager

hadoop集群部署