Hadoop 2.0 Yarn code: NodeManager code analysis _ start of each service module at NM

Source: Internet
Author: User

1. Overview

The following describes how NodeManager starts and registers various services.

Mainly involved Java files

Package org. apache. hadoop. yarn. server. nodemanager under hadoop-yarn-server-nodemanager

NodeManager. java

 

2. Code Analysis

NodeManager in NodeManager. java: When Hadoop is started, the main function in NodeManager is called.

 

1). main Function

  • Output Information to log, create a NodeMananger object,
  • Call initAndStartNodeManager (false)

 

2). initAndStartNodeManager Function

  • After the initAndStartNodeManager () function is called, The system reads the configuration information of YarnConfiguration.
  • Call the init () function for initialization. For details, refer to 3)
  • Call the start () function. The main operation is to start each Service. See figure 4)

 

3). init Function

  • Perform basic configuration operations, such as reading parameters from the configuration file.
  • Create and add DeletionService and NodeHealthCheckerService to an ArrayList <Service> Object serviceList of the parent class.
  • Call the createNodeStatusUpdater () function to create the NodeStatusUpdater object, and then call the NodeManager parent class method register to register this object and add the ArrayList of the parent class to the listeners object.
  • Call the createContainerManager (), createWebServer (), and createNodeResourceMonitor functions to create the ContainerManagerImpl object, Service object, and NodeResourceMonitor object, and add it to serviceList.
  • Register ContainerManagerImpl to the previously created asynchronous event scheduler AsyncDispatcher, and then add the AsyncDispatcher scheduler to the Service Queue serviceList.
  • Add the NodeStatusUpdater object to serviceList. The reason for adding this object is that the heartbeat operation must be started after all other services.
  • Call the init () function of the parent class to initialize other configurations.

 

4) start Function

  • Perform Security Authentication
  • Call the start () function of the parent class to start all the added services in step 3. AsyncDispatcher is responsible for event transmission, NodeStatusUpdater is responsible for generating heartbeat events, and ContainerManagerImpl is responsible for providing functions required by Hadoop RPC, etc.

 

The overall relationship is given. The relationships among NodeStatusUpdater, AsyncDispatcher, and ContainerManagerImpl are given. These three classes will be involved in code analysis in many aspects in the future.

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.