Search in sources :

Example 1 with JvmPauseMonitor

use of org.apache.hadoop.util.JvmPauseMonitor in project hadoop by apache.

the class NodeManager method serviceInit.

@Override
protected void serviceInit(Configuration conf) throws Exception {
    conf.setBoolean(Dispatcher.DISPATCHER_EXIT_ON_ERROR_KEY, true);
    rmWorkPreservingRestartEnabled = conf.getBoolean(YarnConfiguration.RM_WORK_PRESERVING_RECOVERY_ENABLED, YarnConfiguration.DEFAULT_RM_WORK_PRESERVING_RECOVERY_ENABLED);
    try {
        initAndStartRecoveryStore(conf);
    } catch (IOException e) {
        String recoveryDirName = conf.get(YarnConfiguration.NM_RECOVERY_DIR);
        throw new YarnRuntimeException("Unable to initialize recovery directory at " + recoveryDirName, e);
    }
    NMContainerTokenSecretManager containerTokenSecretManager = new NMContainerTokenSecretManager(conf, nmStore);
    NMTokenSecretManagerInNM nmTokenSecretManager = new NMTokenSecretManagerInNM(nmStore);
    recoverTokens(nmTokenSecretManager, containerTokenSecretManager);
    this.aclsManager = new ApplicationACLsManager(conf);
    ContainerExecutor exec = ReflectionUtils.newInstance(conf.getClass(YarnConfiguration.NM_CONTAINER_EXECUTOR, DefaultContainerExecutor.class, ContainerExecutor.class), conf);
    try {
        exec.init();
    } catch (IOException e) {
        throw new YarnRuntimeException("Failed to initialize container executor", e);
    }
    DeletionService del = createDeletionService(exec);
    addService(del);
    // NodeManager level dispatcher
    this.dispatcher = new AsyncDispatcher("NM Event dispatcher");
    dirsHandler = new LocalDirsHandlerService(metrics);
    nodeHealthChecker = new NodeHealthCheckerService(getNodeHealthScriptRunner(conf), dirsHandler);
    addService(nodeHealthChecker);
    boolean isDistSchedulingEnabled = conf.getBoolean(YarnConfiguration.DIST_SCHEDULING_ENABLED, YarnConfiguration.DEFAULT_DIST_SCHEDULING_ENABLED);
    this.context = createNMContext(containerTokenSecretManager, nmTokenSecretManager, nmStore, isDistSchedulingEnabled, conf);
    ((NMContext) context).setContainerExecutor(exec);
    nodeLabelsProvider = createNodeLabelsProvider(conf);
    if (null == nodeLabelsProvider) {
        nodeStatusUpdater = createNodeStatusUpdater(context, dispatcher, nodeHealthChecker);
    } else {
        addIfService(nodeLabelsProvider);
        nodeStatusUpdater = createNodeStatusUpdater(context, dispatcher, nodeHealthChecker, nodeLabelsProvider);
    }
    nodeResourceMonitor = createNodeResourceMonitor();
    addService(nodeResourceMonitor);
    ((NMContext) context).setNodeResourceMonitor(nodeResourceMonitor);
    containerManager = createContainerManager(context, exec, del, nodeStatusUpdater, this.aclsManager, dirsHandler);
    addService(containerManager);
    ((NMContext) context).setContainerManager(containerManager);
    WebServer webServer = createWebServer(context, containerManager.getContainersMonitor(), this.aclsManager, dirsHandler);
    addService(webServer);
    ((NMContext) context).setWebServer(webServer);
    ((NMContext) context).setQueueableContainerAllocator(new OpportunisticContainerAllocator(context.getContainerTokenSecretManager()));
    dispatcher.register(ContainerManagerEventType.class, containerManager);
    dispatcher.register(NodeManagerEventType.class, this);
    addService(dispatcher);
    pauseMonitor = new JvmPauseMonitor();
    addService(pauseMonitor);
    metrics.getJvmMetrics().setPauseMonitor(pauseMonitor);
    DefaultMetricsSystem.initialize("NodeManager");
    if (YarnConfiguration.timelineServiceV2Enabled(conf)) {
        this.nmCollectorService = createNMCollectorService(context);
        addService(nmCollectorService);
    }
    // StatusUpdater should be added last so that it get started last 
    // so that we make sure everything is up before registering with RM. 
    addService(nodeStatusUpdater);
    ((NMContext) context).setNodeStatusUpdater(nodeStatusUpdater);
    super.serviceInit(conf);
// TODO add local dirs to del
}
Also used : NMTokenSecretManagerInNM(org.apache.hadoop.yarn.server.nodemanager.security.NMTokenSecretManagerInNM) IOException(java.io.IOException) JvmPauseMonitor(org.apache.hadoop.util.JvmPauseMonitor) YarnRuntimeException(org.apache.hadoop.yarn.exceptions.YarnRuntimeException) ApplicationACLsManager(org.apache.hadoop.yarn.server.security.ApplicationACLsManager) AsyncDispatcher(org.apache.hadoop.yarn.event.AsyncDispatcher) WebServer(org.apache.hadoop.yarn.server.nodemanager.webapp.WebServer) NMContainerTokenSecretManager(org.apache.hadoop.yarn.server.nodemanager.security.NMContainerTokenSecretManager) OpportunisticContainerAllocator(org.apache.hadoop.yarn.server.scheduler.OpportunisticContainerAllocator)

Example 2 with JvmPauseMonitor

use of org.apache.hadoop.util.JvmPauseMonitor in project hadoop by apache.

the class RpcProgramNfs3 method startDaemons.

@Override
public void startDaemons() {
    if (pauseMonitor == null) {
        pauseMonitor = new JvmPauseMonitor();
        pauseMonitor.init(config);
        pauseMonitor.start();
        metrics.getJvmMetrics().setPauseMonitor(pauseMonitor);
    }
    writeManager.startAsyncDataService();
    try {
        infoServer.start();
    } catch (IOException e) {
        LOG.error("failed to start web server", e);
    }
}
Also used : IOException(java.io.IOException) JvmPauseMonitor(org.apache.hadoop.util.JvmPauseMonitor)

Example 3 with JvmPauseMonitor

use of org.apache.hadoop.util.JvmPauseMonitor in project hadoop by apache.

the class TestJvmMetrics method testDoubleStart.

@Test
public void testDoubleStart() throws Throwable {
    pauseMonitor = new JvmPauseMonitor();
    pauseMonitor.init(new Configuration());
    pauseMonitor.start();
    pauseMonitor.start();
    pauseMonitor.stop();
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) JvmPauseMonitor(org.apache.hadoop.util.JvmPauseMonitor) Test(org.junit.Test)

Example 4 with JvmPauseMonitor

use of org.apache.hadoop.util.JvmPauseMonitor in project hadoop by apache.

the class TestJvmMetrics method testStopBeforeInit.

@Test
public void testStopBeforeInit() throws Throwable {
    pauseMonitor = new JvmPauseMonitor();
    try {
        pauseMonitor.stop();
        pauseMonitor.init(new Configuration());
        Assert.fail("Expected an exception, got " + pauseMonitor);
    } catch (ServiceStateException e) {
        GenericTestUtils.assertExceptionContains("cannot enter state", e);
    }
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) ServiceStateException(org.apache.hadoop.service.ServiceStateException) JvmPauseMonitor(org.apache.hadoop.util.JvmPauseMonitor) Test(org.junit.Test)

Example 5 with JvmPauseMonitor

use of org.apache.hadoop.util.JvmPauseMonitor in project hadoop by apache.

the class NameNode method initialize.

/**
   * Initialize name-node.
   * 
   * @param conf the configuration
   */
protected void initialize(Configuration conf) throws IOException {
    if (conf.get(HADOOP_USER_GROUP_METRICS_PERCENTILES_INTERVALS) == null) {
        String intervals = conf.get(DFS_METRICS_PERCENTILES_INTERVALS_KEY);
        if (intervals != null) {
            conf.set(HADOOP_USER_GROUP_METRICS_PERCENTILES_INTERVALS, intervals);
        }
    }
    UserGroupInformation.setConfiguration(conf);
    loginAsNameNodeUser(conf);
    NameNode.initMetrics(conf, this.getRole());
    StartupProgressMetrics.register(startupProgress);
    pauseMonitor = new JvmPauseMonitor();
    pauseMonitor.init(conf);
    pauseMonitor.start();
    metrics.getJvmMetrics().setPauseMonitor(pauseMonitor);
    if (NamenodeRole.NAMENODE == role) {
        startHttpServer(conf);
    }
    loadNamesystem(conf);
    rpcServer = createRpcServer(conf);
    initReconfigurableBackoffKey();
    if (clientNamenodeAddress == null) {
        // This is expected for MiniDFSCluster. Set it now using 
        // the RPC server's bind address.
        clientNamenodeAddress = NetUtils.getHostPortString(getNameNodeAddress());
        LOG.info("Clients are to use " + clientNamenodeAddress + " to access" + " this namenode/service.");
    }
    if (NamenodeRole.NAMENODE == role) {
        httpServer.setNameNodeAddress(getNameNodeAddress());
        httpServer.setFSImage(getFSImage());
    }
    startCommonServices(conf);
    startMetricsLogger(conf);
}
Also used : JvmPauseMonitor(org.apache.hadoop.util.JvmPauseMonitor)

Aggregations

JvmPauseMonitor (org.apache.hadoop.util.JvmPauseMonitor)12 Configuration (org.apache.hadoop.conf.Configuration)7 Test (org.junit.Test)5 IOException (java.io.IOException)4 JvmMetrics (org.apache.hadoop.metrics2.source.JvmMetrics)3 YarnRuntimeException (org.apache.hadoop.yarn.exceptions.YarnRuntimeException)3 ServiceStateException (org.apache.hadoop.service.ServiceStateException)2 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)2 SaslDataTransferClient (org.apache.hadoop.hdfs.protocol.datatransfer.sasl.SaslDataTransferClient)1 SaslDataTransferServer (org.apache.hadoop.hdfs.protocol.datatransfer.sasl.SaslDataTransferServer)1 BlockPoolTokenSecretManager (org.apache.hadoop.hdfs.security.token.block.BlockPoolTokenSecretManager)1 ErasureCodingWorker (org.apache.hadoop.hdfs.server.datanode.erasurecode.ErasureCodingWorker)1 DataNodeDiskMetrics (org.apache.hadoop.hdfs.server.datanode.metrics.DataNodeDiskMetrics)1 HSAdminServer (org.apache.hadoop.mapreduce.v2.hs.server.HSAdminServer)1 MetricsCollector (org.apache.hadoop.metrics2.MetricsCollector)1 MetricsRecordBuilder (org.apache.hadoop.metrics2.MetricsRecordBuilder)1 JvmMetricsInfo (org.apache.hadoop.metrics2.source.JvmMetricsInfo)1 DiskErrorException (org.apache.hadoop.util.DiskChecker.DiskErrorException)1 AsyncDispatcher (org.apache.hadoop.yarn.event.AsyncDispatcher)1 AggregatedLogDeletionService (org.apache.hadoop.yarn.logaggregation.AggregatedLogDeletionService)1