一.三种启动方式介绍
方式一:逐一启动(实际生产环境中的启动方式)
hadoop-daemon.sh start|stop namenode|datanode| journalnode
yarn-daemon.sh start |stop resourcemanager|nodemanager
方式二:分开启动
start-dfs.sh
start-yarn.sh
方式三:一起启动
start-all.sh
二.脚本解读
start-dfs.sh脚本:
(1) 通过命令bin/hdfs getconf –namenodes查看namenode在那些节点上
(2) 通过ssh方式登录到远程主机,启动hadoop-deamons.sh脚本
(3) hadoop-deamon.sh脚本启动slaves.sh脚本
(4) slaves.sh脚本启动hadoop-deamon.sh脚本,再逐一启动
start-all.sh脚本:
说明:start-all.sh实际上是调用sbin/start-dfs.sh脚本和sbin/start-yarn.sh脚本
三.三种启动方式的关系
start-all.sh其实调用start-dfs.sh和start-yarn.sh
start-dfs.sh调用hadoop-deamon.sh
start-yarn.sh调用yarn-deamon.sh
如下图:
四.为什么要设置ssh协议
当执行start-dfs.sh脚本时,会调用slaves.sh脚本,通过ssh协议无密码登陆到其他节点去启动进程。
为了能自动启动远程节点的进程,需要进行免密码登录。
五.采用第二种启动方式
上面已经配置好了ssh公钥登录,接下来用第二种启动方式启动
Step1:先停止所以进程(如果已经启动)
[hadoop@hadoop-yarn hadoop-2.2.0]$sbin/yarn-daemon.sh stop nodemanager
[hadoop@hadoop-yarn hadoop-2.2.0]$sbin/yarn-daemon.sh stop resourcemanager
[hadoop@hadoop-yarn hadoop-2.2.0]$sbin/hadoop-daemon.sh stop datanode
[hadoop@hadoop-yarn hadoop-2.2.0]$sbin/hadoop-daemon.sh stop secondarynamenode
[hadoop@hadoop-yarn hadoop-2.2.0]$sbin/hadoop-daemon.sh stop namenode
Step2:启动所以进程
[hadoop@hadoop-yarn hadoop-2.2.0]$sbin/start-dfs.sh
[hadoop@hadoop-yarn hadoop-2.2.0]$ sbin/start-yarn.sh
Step3:查看管理界面
YARN: http://hadoop-yarn.dragon.org:8088/
HDFS: http://hadoop-yarn.dragon.org:50070/
转:http://blog.csdn.net/cloudyhadoop/article/details/42341165