當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。