标签:hadoop
事件驱动和状态转移,在很大程度上保证了大型系统的顺利推进。状态转移有如下好处:
Hadoop也大量采用了这种方法,如MapReduce的状态转移,NM和RM中资源、任务的管理.
hadoop内部的状态转移图,是可以通过程序生成的。方法:使用类VisualizeStateMachine,在运行的时候指定三个参数:图的名字、包含事件转移的类(类之间通过”,”隔开)、生成的文件名(.gv格式),如
$ hadoop org.apache.hadoop.yarn.state.VisualizeStateMachine TaskStateChange org.apache.hadoop.mapreduce.v2.app.job.impl.TaskImpl TaskImpl.gv
生成的图如下
$mvn -Pvisualize compile
$dot -Tpng NodeManager.gv > NodeManager.png; dot -Tpng ResourceManager.gv > ResourceManager.png; dot -Tpng MapReduce.gv > MapReduce.png;
hadoop中使用状态转移的大致有三类:MapReduce、NodeManager、ResourceManager,下面将给出生成这三大类转移图的脚本
MapReduce相关
hadoop org.apache.hadoop.yarn.state.VisualizeStateMachine MapReduce org.apache.hadoop.mapreduce.v2.app.job.impl.JobImpl,org.apache.hadoop.mapreduce.v2.app.job.impl.TaskImpl,org.apache.hadoop.mapreduce.v2.app.job.impl.TaskAttemptImpl MapReduce.gv
NodeManager相关
hadoop org.apache.hadoop.yarn.state.VisualizeStateMachine NodeManager org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationImpl,org.apache.hadoop.yarn.server.nodemanager.containermanager.container.ContainerImpl,org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.LocalizedResource NodeManager.gv
ResourceManager相关
hadoop org.apache.hadoop.yarn.state.VisualizeStateMachine ResourceManager org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptImpl,org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppImpl,org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainerImpl,org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeImpl ResourceManager.gv
标签:hadoop
原文地址:http://blog.csdn.net/jiewuyou/article/details/45056911