首页 > 其他分享 >dremio 的 YarnDaemon 简单说明

dremio 的 YarnDaemon 简单说明

时间:2023-02-04 13:23:38浏览次数:34  
标签:envVars dremio NAME daemon YARN YarnDaemon 简单 yarnConfiguration

YarnDaemon 与DremioDaemon 基本类似,都是启动dremio 服务,只是YarnDaemon 更多是关于执行器节点的运行模式与
DremioDaemon 差异比较大,DremioDaemon 就是一个long running 任务,但是YarnDaemon 实际上是一个由线程调度出发的
任务,运行时间不如DremioDaemon长,同时会有watchdog 进行服务状态的监控

参考代码

 
public void run() {
  try (TimedBlock b = Timer.time("main")) {
 
    // create a temporary local write path
    final Path localWritePath = Files.createTempDirectory("dremio-executor");
    final DACConfig config = DACConfig.newConfig()
        .writePath(localWritePath.toString());
    logger.info("Local write path set to '{}'", localWritePath);
 
    final SabotConfig sabotConfig = config.getConfig().getSabotConfig();
    final DACModule module = sabotConfig.getInstance(DremioDaemon.DAEMON_MODULE_CLASS, DACModule.class, DACDaemonModule.class);
    try (final DACDaemon daemon = DACDaemon.newDremioDaemon(config, ClassPathScanner.fromPrescan(sabotConfig),
        module)) {
      dacDaemon = daemon;
      // 此部分属于标准DACDaemon 玩法
      daemon.init();
      // Start yarn watchdog
      // 特定于yarn 模式的watchdog
      startYarnWatchdog(daemon);
      daemon.closeOnJVMShutDown();
      daemon.awaitClose();
    }
  } catch (Exception e) {
    throw Throwables.propagate(e);
  }
}

YarnDaemon 的启动

YarnDaemon 是直接由YarnController使用的,属于标准的apache twill

// 启动集群
public TwillController startCluster(YarnConfiguration yarnConfiguration, List<Property> propertyList) {
    TwillController tmpController = createPreparer(yarnConfiguration, propertyList).start();
    return tmpController;
  }
 // TwillPreparer 包装
  protected TwillPreparer createPreparer(YarnConfiguration yarnConfiguration, List<Property> propertyList) {
    // 入口参数定义,就使用了YarnDaemon
    AppBundleRunnable.Arguments discoveryArgs = new AppBundleRunnable.Arguments(
        YARN_BUNDLED_JAR_NAME,
        "com.dremio.dac.daemon.YarnDaemon",
        new String[] {});
 
    DacDaemonYarnApplication dacDaemonApp = new DacDaemonYarnApplication(dremioConfig, yarnConfiguration,
      new DacDaemonYarnApplication.Environment());
 
    TwillRunnerService twillRunner = startTwillRunner(yarnConfiguration);
 
    Map<String, String> envVars = Maps.newHashMap();
    envVars.put("MALLOC_ARENA_MAX", "4");
    envVars.put("MALLOC_MMAP_THRESHOLD_", "131072");
    envVars.put("MALLOC_TRIM_THRESHOLD_", "131072");
    envVars.put("MALLOC_TOP_PAD_", "131072");
    envVars.put("MALLOC_MMAP_MAX_", "65536");
    // Set ${DREMIO_HOME} for YarnDaemon to avoid config substitution failure
    envVars.put(DREMIO_HOME, ".");
 
    try {
      String userName = UserGroupInformation.getCurrentUser().getUserName();
      envVars.put("HADOOP_USER_NAME", userName);
    } catch (IOException e) {
      logger.error("Exception while trying to fill out HADOOP_USER_NAME with current user", e);
    }
 
    for (Property prop : propertyList) {
      // add if it is env var
      if (PropertyType.ENV_VAR.equals(prop.getType())) {
        envVars.put(prop.getKey(), prop.getValue());
      }
    }
    String[] yarnClasspath = yarnConfiguration.getStrings(YarnConfiguration.YARN_APPLICATION_CLASSPATH,
      YarnConfiguration.DEFAULT_YARN_APPLICATION_CLASSPATH);
    final TwillPreparer preparer = twillRunner.prepare(dacDaemonApp)
      .addLogHandler(new YarnTwillLogHandler())
      .withApplicationClassPaths(yarnClasspath)
      .withBundlerClassAcceptor(new HadoopClassExcluder())
      .setLogLevels(ImmutableMap.of(Logger.ROOT_LOGGER_NAME, yarnContainerLogLevel()))
      .withEnv(YARN_RUNNABLE_NAME, envVars)
      .withMaxRetries(YARN_RUNNABLE_NAME, MAX_APP_RESTART_RETRIES)
      .withArguments(YARN_RUNNABLE_NAME, discoveryArgs.toArray())
      .setJVMOptions(YARN_RUNNABLE_NAME, prepareCommandOptions(yarnConfiguration, propertyList))
      .withClassPaths(dacDaemonApp.getJarNames());
 
    String queue = yarnConfiguration.get(DacDaemonYarnApplication.YARN_QUEUE_NAME);
    if (queue != null) {
      preparer.setSchedulerQueue(queue);
    }
 
    if (dremioConfig.getBoolean(DremioConfig.DEBUG_YARN_ENABLED)) {
      preparer.enableDebugging(true, YARN_RUNNABLE_NAME);
    }
 
    return preparer;
  }

说明

以上只是一个简单的说明,后变会介绍下关于yarn 包装调度部分,通过以上我们可以大致了解到是如果关联系统的

参考资料

dac/daemon/src/main/java/com/dremio/dac/daemon/YarnDaemon.java
provision/yarn/yarntwill/src/main/java/com/dremio/provision/yarn/YarnController.java

标签:envVars,dremio,NAME,daemon,YARN,YarnDaemon,简单,yarnConfiguration
From: https://www.cnblogs.com/rongfengliang/p/17091307.html

相关文章

  • 简单三步ssh连接到虚拟机中的ubuntu
       设置共享文件夹1.首先安装这个工具VMwaretool,具体操作就是在ubuntu里面解压,然后sudo执行那个pl安装脚本2.执行命令挂载共享文件夹   sudovmhgfs-fuse......
  • 中间件Canal之Canal简单使用
    一.简单介绍​​Canal​​​是​​Java​​​开发的基于数据库增量日志解析,提供增量数据订阅&消费的中间件。目前,​​Canal​​​主要支持了​​MySQL​​​的​​Binlog​......
  • 国内简单注册chatGPT流程
        挂代理,选美国那些国家注册#ChatGPT的步骤:-挂代理,注册,登陆-http://sms-activate.org/cn支付宝充值0.5美元,选择印度手机号收验证码激活-访问http://c......
  • ZOJ4113 Calandar (简单模拟)
    Description:Input OutputSampleInput42019512Monday20195142019512Tuesday201912302019512Friday100000000011100000000011Wednesday201951......
  • RabbitMq:简单的生产者代码。(包含QueueDeclare声明队列参数)
    ConnectionFactoryconn=newConnectionFactory();conn.setVirtualHost("/");conn.setPort(5672);......
  • jQuery_EasyUI_简单使用
    EasyUI是基于jQuery、Angular.、Vue和React的用户界面组件的集合。 使用流程1、下载EasyUI包jQueryEasyUI下载-EasyUI中文站(jeasyui.cn)2、引入EasyUI包......
  • Converting Boolean-Logic Decision Trees to Finite State Machines 如何将布尔表达
    ConvertingBoolean-LogicDecisionTreestoFiniteStateMachinesforsimpler,high-performancedetectionofcybersecurityevents将布尔逻辑决策树转换......
  • 简单Shader应用
    //透明通道        Tags { "Queue" = "Transparent" "RenderType" = "Transparent" }        LOD 100        ZWrite Off      ......
  • 本地通知UserNotifications的简单使用
    有三个概念要区分下:(1)通知中心:这个是语法中的设计模式,一对多的广播通知,代码中订阅了该通知的监听者可以接受此通知进行处理(2)远程通知:也可以说是APNs通知,极光推送等,一般指......
  • Springboot websocket 的简单使用
    项目结构:引入依赖:"org.springframework.boot:spring-boot-starter-websocket","org.springframework.boot:spring-boot-starter-thymeleaf",启动类:publicclassDem......