hadoop11上边启动namenode/resourceManager
启动HDFS集群 start-dfs.sh (在namenode进程所在主机运行该命令)
启动Yarn集群 start-yarn.sh (在resourceManager进程所在主机运行该命令)
如果在hadoop13上边启动yarn,注意配置hadoop13到集群节点的免密登录
hadoop11
NameNode
DataNode
ResourceManager
NodeManager
JobHistoryServer
hadoop12
SecondaryNameNode
DataNode
NodeManager
hadoop13
DataNode
NodeManager
# 保证HDFS分布式集群搭建环境确保正确。
1. hadoop-env.sh
export YARN_RESOURCEMANAGER_USER=root
export YARN_NODEMANAGER_USER=root
2. mapred-site.xml
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
<!-- 历史服务器端地址 -->
<property>
<name>mapreduce.jobhistory.address</name>
<value>hadoop11:10020</value>
</property>
<!-- 历史服务器 web 端地址 -->
<property>
<name>mapreduce.jobhistory.webapp.address</name>
<value>hadoop11:19888</value>
</property>
3. yarn-site.xml
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<!-- 配置resourcemanager的主机ip -->
<property>
<name>yarn.resourcemanager.hostname</name>
<value>hadoop11</value>
</property>
<property>
<name>yarn.application.classpath</name>
<value>
/opt/installs/hadoop3.1.4/etc/hadoop,
/opt/installs/hadoop3.1.4/share/hadoop/common/*,
/opt/installs/hadoop3.1.4/share/hadoop/common/lib/*,
/opt/installs/hadoop3.1.4/share/hadoop/hdfs/*,
/opt/installs/hadoop3.1.4/share/hadoop/hdfs/lib/*,
/opt/installs/hadoop3.1.4/share/hadoop/mapreduce/*,
/opt/installs/hadoop3.1.4/share/hadoop/mapreduce/lib/*,
/opt/installs/hadoop3.1.4/share/hadoop/yarn/*,
/opt/installs/hadoop3.1.4/share/hadoop/yarn/lib/*
</value>
</property>
<!-- 开启日志聚合 -->
<property>
<name>yarn.log-aggregation-enable</name>
<value>true</value>
</property>
<!-- 设置日志保存时间 7 天 -->
<property>
<name>yarn.log-aggregation.retain-seconds</name>
<value>604800</value>
</property>
4. workers
配置nodemanager(从机)所在的ip。
配置datanode(从机)所在的ip
# 2:同步该配置到其他节点服务器上。
[root@hadoop11 etc]# scp -r hadoop/ root@hadoop12:/opt/installs/hadoop2.9.2/etc/
[root@hadoop11 etc]# scp -r hadoop/ root@hadoop13:/opt/installs/hadoop2.9.2/etc/
myscp分发脚本
# 3:启动yarn集群
# 在namenode所在主机上
1. 启动HDFS集群
start-dfs.sh
# 在Resourcemanager所在主机上
2. 启动yarn集群
start-yarn.sh
mapred --daemon start historyserver
# 4:验证
1. jps
[root@hadoop11 ~]
6160 DataNode
6513 ResourceManager
6614 NodeManager
6056 NameNode
6349 SecondaryNameNode
6831 Jps
25199 JobHistoryServer
2. 访问yarn的资源调度器web网页。
http://主节点ResourceManager节点的ip:8088
# 关闭集群
1. 先关闭yarn和历史日志服务器
stop-yarn.sh
mapred --daemon stop historyserver
2. 在关闭hdfs
stop-hdfs.sh