# 在mini01上执行
[yun@mini01 ~]$ start-dfs.sh
Starting namenodes on [mini01 mini02]
mini01: starting namenode, logging to /app/hadoop-2.7.6/logs/hadoop-yun-namenode-mini01.out
mini02: starting namenode, logging to /app/hadoop-2.7.6/logs/hadoop-yun-namenode-mini02.out
mini07: starting datanode, logging to /app/hadoop-2.7.6/logs/hadoop-yun-datanode-mini07.out
mini06: starting datanode, logging to /app/hadoop-2.7.6/logs/hadoop-yun-datanode-mini06.out
mini05: starting datanode, logging to /app/hadoop-2.7.6/logs/hadoop-yun-datanode-mini05.out
Starting journal nodes [mini05 mini06 mini07]
mini07: journalnode running as process 1691. Stop it first.
mini06: journalnode running as process 1665. Stop it first.
mini05: journalnode running as process 1759. Stop it first.
Starting ZK Failover Controllers on NN hosts [mini01 mini02]
mini01: starting zkfc, logging to /app/hadoop-2.7.6/logs/hadoop-yun-zkfc-mini01.out
mini02: starting zkfc, logging to /app/hadoop-2.7.6/logs/hadoop-yun-zkfc-mini02.out
8.6. 启动YARN
#####注意#####:是在mini03上执行start-yarn.sh,把namenode和resourcemanager分开是因为性能问题
# 因为他们都要占用大量资源,所以把他们分开了,他们分开了就要分别在不同的机器上启动
[yun@mini03 ~]$ start-yarn.sh
starting yarn daemons
starting resourcemanager, logging to /app/hadoop-2.7.6/logs/yarn-yun-resourcemanager-mini03.out
mini06: starting nodemanager, logging to /app/hadoop-2.7.6/logs/yarn-yun-nodemanager-mini06.out
mini07: starting nodemanager, logging to /app/hadoop-2.7.6/logs/yarn-yun-nodemanager-mini07.out
mini05: starting nodemanager, logging to /app/hadoop-2.7.6/logs/yarn-yun-nodemanager-mini05.out
################################
# 在mini04启动 resourcemanager
[yun@mini04 ~]$ yarn-daemon.sh start resourcemanager # 也可用start-yarn.sh
starting resourcemanager, logging to /app/hadoop-2.7.6/logs/yarn-yun-resourcemanager-mini04.out
8.7. 启动说明
# 第一次启动的时候请严格按照上面的步骤【第一次涉及格式化问题】
# 第二次以及之后,步骤为: 启动zookeeper、HDFS、YARN
9. 浏览访问
9.1. Hdfs访问
9.1.1. 正常情况访问
:50070
:50070
9.1.2. mini01挂了Active自动切换
# mini01操作
[yun@mini01 ~]$ jps
3584 DFSZKFailoverController
3283 NameNode
5831 Jps
[yun@mini01 ~]$ kill 3283
[yun@mini01 ~]$ jps
3584 DFSZKFailoverController
5893 Jps
Namenode挂了所以mini01不能访问
:50070
可见Hadoop已经切换过去了,之后mini01即使起来了,状态也只能为standby 。
9.2. Yarn访问
:8088
:8088
会直接跳转到:8088/
# 该图从其他地方截取,所以不怎么匹配
# Linux下访问
[yun@mini01 ~]$ curl mini04:8088
This is standby RM. The redirect url is: :8088/
HA完毕
10. 集群运维测试
10.1. Haadmin与状态切换管理
[yun@mini01 ~]$ hdfs haadmin
Usage: haadmin
[-transitionToActive [--forceactive] <serviceId>]
[-transitionToStandby <serviceId>]
[-failover [--forcefence] [--forceactive] <serviceId> <serviceId>]
[-getServiceState <serviceId>]
[-checkHealth <serviceId>]
[-help <command>]