当前位置: 首页>>代码示例>>Java>>正文


Java WebAppUtils.getWebAppBindURL方法代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.webapp.util.WebAppUtils.getWebAppBindURL方法的典型用法代码示例。如果您正苦于以下问题:Java WebAppUtils.getWebAppBindURL方法的具体用法?Java WebAppUtils.getWebAppBindURL怎么用?Java WebAppUtils.getWebAppBindURL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.yarn.webapp.util.WebAppUtils的用法示例。


在下文中一共展示了WebAppUtils.getWebAppBindURL方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: serviceStart

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
@Override
protected void serviceStart() throws Exception {
  String bindAddress = WebAppUtils.getWebAppBindURL(getConfig(),
                        YarnConfiguration.NM_BIND_HOST,
                        WebAppUtils.getNMWebAppURLWithoutScheme(getConfig()));
  
  LOG.info("Instantiating NMWebApp at " + bindAddress);
  try {
    this.webApp =
        WebApps
          .$for("node", Context.class, this.nmContext, "ws")
          .at(bindAddress)
          .with(getConfig())
          .withHttpSpnegoPrincipalKey(
            YarnConfiguration.NM_WEBAPP_SPNEGO_USER_NAME_KEY)
          .withHttpSpnegoKeytabKey(
            YarnConfiguration.NM_WEBAPP_SPNEGO_KEYTAB_FILE_KEY)
          .start(this.nmWebApp);
    this.port = this.webApp.httpServer().getConnectorAddress(0).getPort();
  } catch (Exception e) {
    String msg = "NMWebapps failed to start.";
    LOG.error(msg, e);
    throw new YarnRuntimeException(msg, e);
  }
  super.serviceStart();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:WebServer.java

示例2: getAMContainerInfoForRMWebService

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
private List<JSONObject> getAMContainerInfoForRMWebService(
    Configuration conf, String appId) throws ClientHandlerException,
    UniformInterfaceException, JSONException {
  Client webServiceClient = Client.create();
  String webAppAddress =
      WebAppUtils.getWebAppBindURL(conf, YarnConfiguration.RM_BIND_HOST,
        WebAppUtils.getRMWebAppURLWithScheme(conf));
  WebResource webResource = webServiceClient.resource(webAppAddress);

  ClientResponse response =
      webResource.path("ws").path("v1").path("cluster").path("apps")
        .path(appId).path("appattempts").accept(MediaType.APPLICATION_JSON)
        .get(ClientResponse.class);
  JSONObject json =
      response.getEntity(JSONObject.class).getJSONObject("appAttempts");
  JSONArray requests = json.getJSONArray("appAttempt");
  List<JSONObject> amContainersList = new ArrayList<JSONObject>();
  for (int i = 0; i < requests.length(); i++) {
    amContainersList.add(requests.getJSONObject(i));
  }
  return amContainersList;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:23,代码来源:LogsCLI.java

示例3: serviceStart

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
@Override
protected void serviceStart() throws Exception {
  String bindAddress = WebAppUtils.getWebAppBindURL(getConfig(),
                        YarnConfiguration.NM_BIND_HOST,
                        WebAppUtils.getNMWebAppURLWithoutScheme(getConfig()));
  boolean enableCors = getConfig()
      .getBoolean(YarnConfiguration.NM_WEBAPP_ENABLE_CORS_FILTER,
          YarnConfiguration.DEFAULT_NM_WEBAPP_ENABLE_CORS_FILTER);
  if (enableCors) {
    getConfig().setBoolean(HttpCrossOriginFilterInitializer.PREFIX
        + HttpCrossOriginFilterInitializer.ENABLED_SUFFIX, true);
  }

  LOG.info("Instantiating NMWebApp at " + bindAddress);
  try {
    this.webApp =
        WebApps
          .$for("node", Context.class, this.nmContext, "ws")
          .at(bindAddress)
          .with(getConfig())
          .withHttpSpnegoPrincipalKey(
            YarnConfiguration.NM_WEBAPP_SPNEGO_USER_NAME_KEY)
          .withHttpSpnegoKeytabKey(
            YarnConfiguration.NM_WEBAPP_SPNEGO_KEYTAB_FILE_KEY)
          .start(this.nmWebApp);
    this.port = this.webApp.httpServer().getConnectorAddress(0).getPort();
  } catch (Exception e) {
    String msg = "NMWebapps failed to start.";
    LOG.error(msg, e);
    throw new YarnRuntimeException(msg, e);
  }
  super.serviceStart();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:34,代码来源:WebServer.java

示例4: serviceInit

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
@Override
protected void serviceInit(Configuration conf) throws Exception {
  this.conf = conf;
  this.rmContext = new RMContextImpl();
  
  this.configurationProvider =
      ConfigurationProviderFactory.getConfigurationProvider(conf);
  this.configurationProvider.init(this.conf);
  rmContext.setConfigurationProvider(configurationProvider);

  // load core-site.xml
  InputStream coreSiteXMLInputStream =
      this.configurationProvider.getConfigurationInputStream(this.conf,
          YarnConfiguration.CORE_SITE_CONFIGURATION_FILE);
  if (coreSiteXMLInputStream != null) {
    this.conf.addResource(coreSiteXMLInputStream);
  }

  // Do refreshUserToGroupsMappings with loaded core-site.xml
  Groups.getUserToGroupsMappingServiceWithLoadedConfiguration(this.conf)
      .refresh();

  // Do refreshSuperUserGroupsConfiguration with loaded core-site.xml
  // Or use RM specific configurations to overwrite the common ones first
  // if they exist
  RMServerUtils.processRMProxyUsersConf(conf);
  ProxyUsers.refreshSuperUserGroupsConfiguration(this.conf);

  // load yarn-site.xml
  InputStream yarnSiteXMLInputStream =
      this.configurationProvider.getConfigurationInputStream(this.conf,
          YarnConfiguration.YARN_SITE_CONFIGURATION_FILE);
  if (yarnSiteXMLInputStream != null) {
    this.conf.addResource(yarnSiteXMLInputStream);
  }

  validateConfigs(this.conf);
  
  // Set HA configuration should be done before login
  this.rmContext.setHAEnabled(HAUtil.isHAEnabled(this.conf));
  if (this.rmContext.isHAEnabled()) {
    HAUtil.verifyAndSetConfiguration(this.conf);
  }
  
  // Set UGI and do login
  // If security is enabled, use login user
  // If security is not enabled, use current user
  this.rmLoginUGI = UserGroupInformation.getCurrentUser();
  try {
    doSecureLogin();
  } catch(IOException ie) {
    throw new YarnRuntimeException("Failed to login", ie);
  }

  // register the handlers for all AlwaysOn services using setupDispatcher().
  rmDispatcher = setupDispatcher();
  addIfService(rmDispatcher);
  rmContext.setDispatcher(rmDispatcher);

  adminService = createAdminService();
  addService(adminService);
  rmContext.setRMAdminService(adminService);
  
  rmContext.setYarnConfiguration(conf);
  
  createAndInitActiveServices();

  webAppAddress = WebAppUtils.getWebAppBindURL(this.conf,
                    YarnConfiguration.RM_BIND_HOST,
                    WebAppUtils.getRMWebAppURLWithoutScheme(this.conf));

  super.serviceInit(this.conf);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:74,代码来源:ResourceManager.java

示例5: startWebApp

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
private void startWebApp() {
  Configuration conf = getConfig();
  TimelineAuthenticationFilter.setTimelineDelegationTokenSecretManager(
      secretManagerService.getTimelineDelegationTokenSecretManager());
  // Always load pseudo authentication filter to parse "user.name" in an URL
  // to identify a HTTP request's user in insecure mode.
  // When Kerberos authentication type is set (i.e., secure mode is turned on),
  // the customized filter will be loaded by the timeline server to do Kerberos
  // + DT authentication.
  String initializers = conf.get("hadoop.http.filter.initializers");
  boolean modifiedInitializers = false;

  initializers =
      initializers == null || initializers.length() == 0 ? "" : initializers;

  if (!initializers.contains(CrossOriginFilterInitializer.class.getName())) {
    if(conf.getBoolean(YarnConfiguration
        .TIMELINE_SERVICE_HTTP_CROSS_ORIGIN_ENABLED, YarnConfiguration
            .TIMELINE_SERVICE_HTTP_CROSS_ORIGIN_ENABLED_DEFAULT)) {
      initializers = CrossOriginFilterInitializer.class.getName() + ","
          + initializers;
      modifiedInitializers = true;
    }
  }

  if (!initializers.contains(TimelineAuthenticationFilterInitializer.class
    .getName())) {
    initializers =
        TimelineAuthenticationFilterInitializer.class.getName() + ","
            + initializers;
    modifiedInitializers = true;
  }

  String[] parts = initializers.split(",");
  ArrayList<String> target = new ArrayList<String>();
  for (String filterInitializer : parts) {
    filterInitializer = filterInitializer.trim();
    if (filterInitializer.equals(AuthenticationFilterInitializer.class
      .getName())) {
      modifiedInitializers = true;
      continue;
    }
    target.add(filterInitializer);
  }
  String actualInitializers =
      org.apache.commons.lang.StringUtils.join(target, ",");
  if (modifiedInitializers) {
    conf.set("hadoop.http.filter.initializers", actualInitializers);
  }
  String bindAddress = WebAppUtils.getWebAppBindURL(conf,
                        YarnConfiguration.TIMELINE_SERVICE_BIND_HOST,
                        WebAppUtils.getAHSWebAppURLWithoutScheme(conf));
  LOG.info("Instantiating AHSWebApp at " + bindAddress);
  try {
    webApp =
        WebApps
          .$for("applicationhistory", ApplicationHistoryClientService.class,
              ahsClientService, "ws")
          .with(conf).at(bindAddress).start(
              new AHSWebApp(timelineDataManager, ahsClientService));
  } catch (Exception e) {
    String msg = "AHSWebApp failed to start.";
    LOG.error(msg, e);
    throw new YarnRuntimeException(msg, e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:67,代码来源:ApplicationHistoryServer.java

示例6: serviceInit

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
@Override
protected void serviceInit(Configuration conf) throws Exception {
  this.conf = conf;
  this.rmContext = new RMContextImpl();
  
  this.configurationProvider =
      ConfigurationProviderFactory.getConfigurationProvider(conf);
  this.configurationProvider.init(this.conf);
  rmContext.setConfigurationProvider(configurationProvider);

  // load core-site.xml
  InputStream coreSiteXMLInputStream =
      this.configurationProvider.getConfigurationInputStream(this.conf,
          YarnConfiguration.CORE_SITE_CONFIGURATION_FILE);
  if (coreSiteXMLInputStream != null) {
    this.conf.addResource(coreSiteXMLInputStream);
  }

  // Do refreshUserToGroupsMappings with loaded core-site.xml
  Groups.getUserToGroupsMappingServiceWithLoadedConfiguration(this.conf)
      .refresh();

  // Do refreshSuperUserGroupsConfiguration with loaded core-site.xml
  // Or use RM specific configurations to overwrite the common ones first
  // if they exist
  RMServerUtils.processRMProxyUsersConf(conf);
  ProxyUsers.refreshSuperUserGroupsConfiguration(this.conf);

  // load yarn-site.xml
  InputStream yarnSiteXMLInputStream =
      this.configurationProvider.getConfigurationInputStream(this.conf,
          YarnConfiguration.YARN_SITE_CONFIGURATION_FILE);
  if (yarnSiteXMLInputStream != null) {
    this.conf.addResource(yarnSiteXMLInputStream);
  }

  validateConfigs(this.conf);
  
  // Set HA configuration should be done before login
  this.rmContext.setHAEnabled(HAUtil.isHAEnabled(this.conf));
  if (this.rmContext.isHAEnabled()) {
    HAUtil.verifyAndSetConfiguration(this.conf);
  }
  
  // Set UGI and do login
  // If security is enabled, use login user
  // If security is not enabled, use current user
  this.rmLoginUGI = UserGroupInformation.getCurrentUser();
  try {
    doSecureLogin();
  } catch(IOException ie) {
    throw new YarnRuntimeException("Failed to login", ie);
  }

  // register the handlers for all AlwaysOn services using setupDispatcher().
  rmDispatcher = setupDispatcher();
  addIfService(rmDispatcher);
  rmContext.setDispatcher(rmDispatcher);

  adminService = createAdminService();
  addService(adminService);
  rmContext.setRMAdminService(adminService);
  
  createAndInitActiveServices();

  webAppAddress = WebAppUtils.getWebAppBindURL(this.conf,
                    YarnConfiguration.RM_BIND_HOST,
                    WebAppUtils.getRMWebAppURLWithoutScheme(this.conf));

  super.serviceInit(this.conf);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:72,代码来源:ResourceManager.java

示例7: startWebApp

import org.apache.hadoop.yarn.webapp.util.WebAppUtils; //导入方法依赖的package包/类
private void startWebApp() {
  Configuration conf = getConfig();
  TimelineAuthenticationFilter.setTimelineDelegationTokenSecretManager(
      secretManagerService.getTimelineDelegationTokenSecretManager());
  // Always load pseudo authentication filter to parse "user.name" in an URL
  // to identify a HTTP request's user in insecure mode.
  // When Kerberos authentication type is set (i.e., secure mode is turned on),
  // the customized filter will be loaded by the timeline server to do Kerberos
  // + DT authentication.
  String initializers = conf.get("hadoop.http.filter.initializers");
  boolean modifiedInitializers = false;

  initializers =
      initializers == null || initializers.length() == 0 ? "" : initializers;

  if (!initializers.contains(CrossOriginFilterInitializer.class.getName())) {
    if(conf.getBoolean(YarnConfiguration
        .TIMELINE_SERVICE_HTTP_CROSS_ORIGIN_ENABLED, YarnConfiguration
            .TIMELINE_SERVICE_HTTP_CROSS_ORIGIN_ENABLED_DEFAULT)) {
      initializers = CrossOriginFilterInitializer.class.getName() + ","
          + initializers;
      modifiedInitializers = true;
    }
  }

  if (!initializers.contains(TimelineAuthenticationFilterInitializer.class
    .getName())) {
    initializers =
        TimelineAuthenticationFilterInitializer.class.getName() + ","
            + initializers;
    modifiedInitializers = true;
  }

  String[] parts = initializers.split(",");
  ArrayList<String> target = new ArrayList<String>();
  for (String filterInitializer : parts) {
    filterInitializer = filterInitializer.trim();
    if (filterInitializer.equals(AuthenticationFilterInitializer.class
      .getName())) {
      modifiedInitializers = true;
      continue;
    }
    target.add(filterInitializer);
  }
  String actualInitializers =
      org.apache.commons.lang.StringUtils.join(target, ",");
  if (modifiedInitializers) {
    conf.set("hadoop.http.filter.initializers", actualInitializers);
  }
  String bindAddress = WebAppUtils.getWebAppBindURL(conf,
                        YarnConfiguration.TIMELINE_SERVICE_BIND_HOST,
                        WebAppUtils.getAHSWebAppURLWithoutScheme(conf));
  LOG.info("Instantiating AHSWebApp at " + bindAddress);
  try {
    webApp =
        WebApps
          .$for("applicationhistory", ApplicationHistoryClientService.class,
              ahsClientService, "ws")
          .with(conf).at(bindAddress).start(
              new AHSWebApp(timelineDataManager, historyManager));
  } catch (Exception e) {
    String msg = "AHSWebApp failed to start.";
    LOG.error(msg, e);
    throw new YarnRuntimeException(msg, e);
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:67,代码来源:ApplicationHistoryServer.java


注:本文中的org.apache.hadoop.yarn.webapp.util.WebAppUtils.getWebAppBindURL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。