# 更改主机名
hostnamectl set-hostname master
# 配置 hosts 映射
vi /etc/hosts
[填以后机器真是 ip] master
ssh-keygen
ssh-copy-id master
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
cd /opt
tar -zxvf jdk-8u77-linux-x64.tar.gz
tar -zxvf hadoop-2.6.0.tar.gz
mv jdk1.8.0_77/ jdk
mv hadoop-2.6.0/ hadoop
cd /opt/hadoop
vi etc/hadoop/hdfs-site.xml
<!-- 增加以下内容 -->
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
vi etc/hadoop/core-site.xml
<!-- 追加以下内容 -->
<property>
<name>fs.defaultFS</name>
<value>hdfs://master:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/opt/hadoop-repo/tmp</value>
</property>
vi etc/hadoop/hadoop-env.sh
# 更改以下内容
export JAVA_HOME=/opt/jdk
vi /etc/profile
# 追加以下内容
export JAVA_HOME=/opt/jdk
export PATH=$PATH:$JAVA_HOME/bin
export HADOOP_HOME=/opt/hadoop
export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
# 使环境变量立刻失效
source /etc/profile
hdfs namenode -format
start-dfs.sh
cp etc/hadoop/mapred-site.xml.template etc/hadoop/mapred-site.xml
vi etc/hadoop/mapred-site.xml
<!-- 追加以下内容 -->
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
vi etc/hadoop/yarn-site.xml
<!-- 追加以下内容 -->
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<!-- 配置 yarn 的主机名 -->
<property>
<name>yarn.resourcemanager.hostname</name>
<value>master</value>
</property>
start-yarn.sh