172.7.15.113 master 172.7.15.114 slave1 172.7.15.115 slave2 關閉selinux 關閉firewalld systemctl disable firewalld systemctl stop firewalld yum install -y iptables-services systemctl enable iptables systemctl start iptables service iptables save
解壓 tar zxf hadoop-2.7.1.tar.gz mv hadoop-2.7.1 /usr/local/hadoop cd /usr/local/hadoop mkdir tmp dfs dfs/data dfs/name 把/usr/local/hadoop 目錄分別拷貝至兩個slave上 (slave1,slave2 上都須要安裝 rsync) rsync -av /usr/local/hadoop slave1:/usr/local/ rsync -av /usr/local/hadoop slave2:/usr/local/
vim /usr/local/hadoop/etc/hadoop/core-site.xml <configuration> <property> <name>fs.defaultFS</name> <value>hdfs://172.7.15.113:9000</value> </property> <property> <name>hadoop.tmp.dir</name> <value>file:/usr/local/hadoop/tmp</value> </property> <property> <name>io.file.buffer.size</name> <value>131702</value> </property> </configuration>
vim /usr/local/hadoop/etc/hadoop/hdfs-site.xml <configuration> <property> <name>dfs.namenode.name.dir</name> <value>file:/usr/local/hadoop/dfs/name</value> </property> <property> <name>dfs.datanode.data.dir</name> <value>file:/usr/local/hadoop/dfs/data</value> </property> <property> <name>dfs.replication</name> <value>2</value> </property> <property> <name>dfs.namenode.secondary.http-address</name> <value>172.7.15.113:9001</value> </property> <property> <name>dfs.webhdfs.enabled</name> <value>true</value> </property> </configuration>
vim /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>172.7.15.113:10020</value> </property> <property> <name>mapreduce.jobhistory.webapp.address</name> <value>172.7.15.113:19888</value> </property> </configuration>
vim /usr/local/hadoop/etc/hadoop/yarn-site.xml <configuration> <property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce_shuffle</value> </property> <property> <name>yarn.nodemanager.auxservices.mapreduce.shuffle.class</name> <value>org.apache.hadoop.mapred.ShuffleHandler</value> </property> <property> <name>yarn.resourcemanager.address</name> <value>172.7.15.113:8032</value> </property> <property> <name>yarn.resourcemanager.scheduler.address</name> <value>172.7.15.113:8030</value> </property> <property> <name>yarn.resourcemanager.resource-tracker.address</name> <value>172.7.15.113:8031</value> </property> <property> <name>yarn.resourcemanager.admin.address</name> <value>172.7.15.113:8033</value> </property> <property> <name>yarn.resourcemanager.webapp.address</name> <value>172.7.15.113:8088</value> </property> <property> <name>yarn.nodemanager.resource.memory-mb</name> <value>768</value> </property> </configuration>
cd /usr/local/hadoop/etc/hadoop vi hadoop-env.sh //更改JAVA_HOME export JAVA_HOME=/usr/local/jdk1.7.0_79 vi yarn-env.sh //更改JAVA_HOME export JAVA_HOME=/usr/local/jdk1.7.0_79 vi slaves //改成以下 172.7.15.114 172.7.15.115
rsync -av /usr/local/hadoop/etc/ slave1:/usr/local/hadoop/etc/ rsync -av /usr/local/hadoop/etc/ slave2:/usr/local/hadoop/etc/
初始化 /usr/local/hadoop/bin/hdfs namenode -format 啓動服務 /usr/local/hadoop/sbin/start-all.sh 中止服務 /usr/local/hadoop/sbin/stop-all.sh 訪問 瀏覽器打開http://172.7.15.113:8088/ 瀏覽器打開http://172.7.15.113:50070/