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


Java YarnConfiguration.useHttps方法代码示例

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


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

示例1: cancelDelegationToken

import org.apache.hadoop.yarn.conf.YarnConfiguration; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void cancelDelegationToken(
    final Token<TimelineDelegationTokenIdentifier> timelineDT)
        throws IOException, YarnException {
  final boolean isTokenServiceAddrEmpty =
      timelineDT.getService().toString().isEmpty();
  final String scheme = isTokenServiceAddrEmpty ? null
      : (YarnConfiguration.useHttps(this.getConfig()) ? "https" : "http");
  final InetSocketAddress address = isTokenServiceAddrEmpty ? null
      : SecurityUtil.getTokenServiceAddr(timelineDT);
  PrivilegedExceptionAction<Void> cancelDTAction =
      new PrivilegedExceptionAction<Void>() {

        @Override
        public Void run() throws Exception {
          // If the timeline DT to cancel is different than cached, replace it.
          // Token to set every time for retry, because when exception happens,
          // DelegationTokenAuthenticatedURL will reset it to null;
          if (!timelineDT.equals(token.getDelegationToken())) {
            token.setDelegationToken((Token) timelineDT);
          }
          DelegationTokenAuthenticatedURL authUrl =
              new DelegationTokenAuthenticatedURL(authenticator,
                  connConfigurator);
          // If the token service address is not available, fall back to use
          // the configured service address.
          final URI serviceURI = isTokenServiceAddrEmpty ? resURI
              : new URI(scheme, null, address.getHostName(),
              address.getPort(), RESOURCE_URI_STR, null, null);
          authUrl.cancelDelegationToken(serviceURI.toURL(), token, doAsUser);
          return null;
        }
      };
  operateDelegationToken(cancelDTAction);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:37,代码来源:TimelineClientImpl.java

示例2: getTimelineTokenServiceAddress

import org.apache.hadoop.yarn.conf.YarnConfiguration; //导入方法依赖的package包/类
public static InetSocketAddress getTimelineTokenServiceAddress(
    Configuration conf) {
  InetSocketAddress timelineServiceAddr = null;
  if (YarnConfiguration.useHttps(conf)) {
    timelineServiceAddr = conf.getSocketAddr(
        YarnConfiguration.TIMELINE_SERVICE_WEBAPP_HTTPS_ADDRESS,
        YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_HTTPS_ADDRESS,
        YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_HTTPS_PORT);
  } else {
    timelineServiceAddr = conf.getSocketAddr(
        YarnConfiguration.TIMELINE_SERVICE_WEBAPP_ADDRESS,
        YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_ADDRESS,
        YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_PORT);
  }
  return timelineServiceAddr;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:TimelineUtils.java

示例3: findRedirectUrl

import org.apache.hadoop.yarn.conf.YarnConfiguration; //导入方法依赖的package包/类
protected String findRedirectUrl() throws ServletException {
  String addr;
  if (proxyUriBases.size() == 1) {  // external proxy or not RM HA
    addr = proxyUriBases.values().iterator().next();
  } else {                          // RM HA
    YarnConfiguration conf = new YarnConfiguration();
    String activeRMId = RMHAUtils.findActiveRMHAId(conf);
    String addressPropertyPrefix = YarnConfiguration.useHttps(conf)
        ? YarnConfiguration.RM_WEBAPP_HTTPS_ADDRESS
        : YarnConfiguration.RM_WEBAPP_ADDRESS;
    String host = conf.get(
        HAUtil.addSuffix(addressPropertyPrefix, activeRMId));
    addr = proxyUriBases.get(host);
  }
  if (addr == null) {
    throw new ServletException(
        "Could not determine the proxy server for redirection");
  }
  return addr;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:AmIpFilter.java

示例4: buildRedirectPath

import org.apache.hadoop.yarn.conf.YarnConfiguration; //导入方法依赖的package包/类
private String buildRedirectPath() {
  // make a copy of the original configuration so not to mutate it. Also use
  // an YarnConfiguration to force loading of yarn-site.xml.
  YarnConfiguration yarnConf = new YarnConfiguration(rm.getConfig());
  String activeRMHAId = RMHAUtils.findActiveRMHAId(yarnConf);
  String path = "";
  if (activeRMHAId != null) {
    yarnConf.set(YarnConfiguration.RM_HA_ID, activeRMHAId);

    InetSocketAddress sock = YarnConfiguration.useHttps(yarnConf)
        ? yarnConf.getSocketAddr(YarnConfiguration.RM_WEBAPP_HTTPS_ADDRESS,
            YarnConfiguration.DEFAULT_RM_WEBAPP_HTTPS_ADDRESS,
            YarnConfiguration.DEFAULT_RM_WEBAPP_HTTPS_PORT)
        : yarnConf.getSocketAddr(YarnConfiguration.RM_WEBAPP_ADDRESS,
            YarnConfiguration.DEFAULT_RM_WEBAPP_ADDRESS,
            YarnConfiguration.DEFAULT_RM_WEBAPP_PORT);

    path = sock.getHostName() + ":" + Integer.toString(sock.getPort());
    path = YarnConfiguration.useHttps(yarnConf)
        ? "https://" + path
        : "http://" + path;
  }
  return path;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:RMWebApp.java

示例5: setRMWebAppHostnameAndPort

import org.apache.hadoop.yarn.conf.YarnConfiguration; //导入方法依赖的package包/类
public static void setRMWebAppHostnameAndPort(Configuration conf,
    String hostname, int port) {
  String resolvedAddress = hostname + ":" + port;
  if (YarnConfiguration.useHttps(conf)) {
    conf.set(YarnConfiguration.RM_WEBAPP_HTTPS_ADDRESS, resolvedAddress);
  } else {
    conf.set(YarnConfiguration.RM_WEBAPP_ADDRESS, resolvedAddress);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:WebAppUtils.java

示例6: setNMWebAppHostNameAndPort

import org.apache.hadoop.yarn.conf.YarnConfiguration; //导入方法依赖的package包/类
public static void setNMWebAppHostNameAndPort(Configuration conf,
    String hostName, int port) {
  if (YarnConfiguration.useHttps(conf)) {
    conf.set(YarnConfiguration.NM_WEBAPP_HTTPS_ADDRESS,
        hostName + ":" + port);
  } else {
    conf.set(YarnConfiguration.NM_WEBAPP_ADDRESS,
        hostName + ":" + port);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:WebAppUtils.java

示例7: getRMWebAppURLWithoutScheme

import org.apache.hadoop.yarn.conf.YarnConfiguration; //导入方法依赖的package包/类
public static String getRMWebAppURLWithoutScheme(Configuration conf) {
  if (YarnConfiguration.useHttps(conf)) {
    return conf.get(YarnConfiguration.RM_WEBAPP_HTTPS_ADDRESS,
        YarnConfiguration.DEFAULT_RM_WEBAPP_HTTPS_ADDRESS);
  }else {
    return conf.get(YarnConfiguration.RM_WEBAPP_ADDRESS,
        YarnConfiguration.DEFAULT_RM_WEBAPP_ADDRESS);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:WebAppUtils.java

示例8: getNMWebAppURLWithoutScheme

import org.apache.hadoop.yarn.conf.YarnConfiguration; //导入方法依赖的package包/类
public static String getNMWebAppURLWithoutScheme(Configuration conf) {
  if (YarnConfiguration.useHttps(conf)) {
    return conf.get(YarnConfiguration.NM_WEBAPP_HTTPS_ADDRESS,
      YarnConfiguration.DEFAULT_NM_WEBAPP_HTTPS_ADDRESS);
  } else {
    return conf.get(YarnConfiguration.NM_WEBAPP_ADDRESS,
      YarnConfiguration.DEFAULT_NM_WEBAPP_ADDRESS);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:WebAppUtils.java

示例9: getAHSWebAppURLWithoutScheme

import org.apache.hadoop.yarn.conf.YarnConfiguration; //导入方法依赖的package包/类
public static String getAHSWebAppURLWithoutScheme(Configuration conf) {
  if (YarnConfiguration.useHttps(conf)) {
    return conf.get(YarnConfiguration.TIMELINE_SERVICE_WEBAPP_HTTPS_ADDRESS,
      YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_HTTPS_ADDRESS);
  } else {
    return conf.get(YarnConfiguration.TIMELINE_SERVICE_WEBAPP_ADDRESS,
      YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_ADDRESS);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:WebAppUtils.java

示例10: renewDelegationToken

import org.apache.hadoop.yarn.conf.YarnConfiguration; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public long renewDelegationToken(
    final Token<TimelineDelegationTokenIdentifier> timelineDT)
        throws IOException, YarnException {
  final boolean isTokenServiceAddrEmpty =
      timelineDT.getService().toString().isEmpty();
  final String scheme = isTokenServiceAddrEmpty ? null
      : (YarnConfiguration.useHttps(this.getConfig()) ? "https" : "http");
  final InetSocketAddress address = isTokenServiceAddrEmpty ? null
      : SecurityUtil.getTokenServiceAddr(timelineDT);
  PrivilegedExceptionAction<Long> renewDTAction =
      new PrivilegedExceptionAction<Long>() {

        @Override
        public Long run() throws Exception {
          // If the timeline DT to renew is different than cached, replace it.
          // Token to set every time for retry, because when exception happens,
          // DelegationTokenAuthenticatedURL will reset it to null;
          if (!timelineDT.equals(token.getDelegationToken())) {
            token.setDelegationToken((Token) timelineDT);
          }
          DelegationTokenAuthenticatedURL authUrl =
              new DelegationTokenAuthenticatedURL(authenticator,
                  connConfigurator);
          // If the token service address is not available, fall back to use
          // the configured service address.
          final URI serviceURI = isTokenServiceAddrEmpty ? resURI
              : new URI(scheme, null, address.getHostName(),
              address.getPort(), RESOURCE_URI_STR, null, null);
          return authUrl
              .renewDelegationToken(serviceURI.toURL(), token, doAsUser);
        }
      };
  return (Long) operateDelegationToken(renewDTAction);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:37,代码来源:TimelineClientImpl.java

示例11: serviceStart

import org.apache.hadoop.yarn.conf.YarnConfiguration; //导入方法依赖的package包/类
@Override
protected void serviceStart() throws Exception {
  try {
    Configuration conf = getConfig();
    HttpServer2.Builder b = new HttpServer2.Builder()
        .setName("proxy")
        .addEndpoint(
            URI.create(WebAppUtils.getHttpSchemePrefix(conf) + bindAddress
                + ":" + port)).setFindPort(port == 0).setConf(getConfig())
        .setACL(acl);
    if (YarnConfiguration.useHttps(conf)) {
      WebAppUtils.loadSslConfiguration(b);
    }
    proxyServer = b.build();
    proxyServer.addServlet(ProxyUriUtils.PROXY_SERVLET_NAME,
        ProxyUriUtils.PROXY_PATH_SPEC, WebAppProxyServlet.class);
    proxyServer.setAttribute(FETCHER_ATTRIBUTE, fetcher);
    proxyServer
        .setAttribute(IS_SECURITY_ENABLED_ATTRIBUTE, isSecurityEnabled);
    proxyServer.setAttribute(PROXY_HOST_ATTRIBUTE, proxyHost);
    proxyServer.start();
  } catch (IOException e) {
    LOG.error("Could not start proxy web server",e);
    throw e;
  }
  super.serviceStart();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:28,代码来源:WebAppProxy.java

示例12: getHttpSchemePrefix

import org.apache.hadoop.yarn.conf.YarnConfiguration; //导入方法依赖的package包/类
/**
 * Choose which scheme (HTTP or HTTPS) to use when generating a URL based on
 * the configuration.
 * 
 * @return the scheme (HTTP / HTTPS)
 */
public static String getHttpSchemePrefix(Configuration conf) {
  return YarnConfiguration.useHttps(conf) ? HTTPS_PREFIX : HTTP_PREFIX;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:WebAppUtils.java


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