Java Code Examples for org.apache.hadoop.conf.Configuration#updateConnectAddr()

The following examples show how to use org.apache.hadoop.conf.Configuration#updateConnectAddr() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
@Override
protected void serviceStart() throws Exception {
  Configuration conf = getConfig();
  this.metrics = SharedCacheUploaderMetrics.getInstance();

  YarnRPC rpc = YarnRPC.create(conf);
  this.server =
      rpc.getServer(SCMUploaderProtocol.class, this, bindAddress,
          conf, null, // Secret manager null for now (security not supported)
          conf.getInt(YarnConfiguration.SCM_UPLOADER_SERVER_THREAD_COUNT,
              YarnConfiguration.DEFAULT_SCM_UPLOADER_SERVER_THREAD_COUNT));

  // TODO (YARN-2774): Enable service authorization

  this.server.start();
  bindAddress =
      conf.updateConnectAddr(YarnConfiguration.SCM_UPLOADER_SERVER_ADDRESS,
          server.getListenerAddress());

  super.serviceStart();
}
 
Example 2
Source Project: hadoop   File: ClientProtocolService.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void serviceStart() throws Exception {
  Configuration conf = getConfig();
  this.metrics = ClientSCMMetrics.getInstance();

  YarnRPC rpc = YarnRPC.create(conf);
  this.server =
      rpc.getServer(ClientSCMProtocol.class, this,
          clientBindAddress,
          conf, null, // Secret manager null for now (security not supported)
          conf.getInt(YarnConfiguration.SCM_CLIENT_SERVER_THREAD_COUNT,
              YarnConfiguration.DEFAULT_SCM_CLIENT_SERVER_THREAD_COUNT));

  // TODO (YARN-2774): Enable service authorization

  this.server.start();
  clientBindAddress =
      conf.updateConnectAddr(YarnConfiguration.SCM_CLIENT_SERVER_ADDRESS,
          server.getListenerAddress());

  super.serviceStart();
}
 
Example 3
Source Project: hadoop   File: SCMAdminProtocolService.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void serviceStart() throws Exception {
  Configuration conf = getConfig();
  YarnRPC rpc = YarnRPC.create(conf);
  this.server =
      rpc.getServer(SCMAdminProtocol.class, this,
          clientBindAddress,
          conf, null, // Secret manager null for now (security not supported)
          conf.getInt(YarnConfiguration.SCM_ADMIN_CLIENT_THREAD_COUNT,
              YarnConfiguration.DEFAULT_SCM_ADMIN_CLIENT_THREAD_COUNT));

  // TODO: Enable service authorization (see YARN-2774)

  this.server.start();
  clientBindAddress =
      conf.updateConnectAddr(YarnConfiguration.SCM_ADMIN_ADDRESS,
          server.getListenerAddress());

  super.serviceStart();
}
 
Example 4
@Override
protected void serviceStart() throws Exception {
  Configuration conf = getConfig();
  this.metrics = SharedCacheUploaderMetrics.getInstance();

  YarnRPC rpc = YarnRPC.create(conf);
  this.server =
      rpc.getServer(SCMUploaderProtocol.class, this, bindAddress,
          conf, null, // Secret manager null for now (security not supported)
          conf.getInt(YarnConfiguration.SCM_UPLOADER_SERVER_THREAD_COUNT,
              YarnConfiguration.DEFAULT_SCM_UPLOADER_SERVER_THREAD_COUNT));

  // TODO (YARN-2774): Enable service authorization

  this.server.start();
  bindAddress =
      conf.updateConnectAddr(YarnConfiguration.SCM_UPLOADER_SERVER_ADDRESS,
          server.getListenerAddress());

  super.serviceStart();
}
 
Example 5
Source Project: big-c   File: ClientProtocolService.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void serviceStart() throws Exception {
  Configuration conf = getConfig();
  this.metrics = ClientSCMMetrics.getInstance();

  YarnRPC rpc = YarnRPC.create(conf);
  this.server =
      rpc.getServer(ClientSCMProtocol.class, this,
          clientBindAddress,
          conf, null, // Secret manager null for now (security not supported)
          conf.getInt(YarnConfiguration.SCM_CLIENT_SERVER_THREAD_COUNT,
              YarnConfiguration.DEFAULT_SCM_CLIENT_SERVER_THREAD_COUNT));

  // TODO (YARN-2774): Enable service authorization

  this.server.start();
  clientBindAddress =
      conf.updateConnectAddr(YarnConfiguration.SCM_CLIENT_SERVER_ADDRESS,
          server.getListenerAddress());

  super.serviceStart();
}
 
Example 6
Source Project: big-c   File: SCMAdminProtocolService.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void serviceStart() throws Exception {
  Configuration conf = getConfig();
  YarnRPC rpc = YarnRPC.create(conf);
  this.server =
      rpc.getServer(SCMAdminProtocol.class, this,
          clientBindAddress,
          conf, null, // Secret manager null for now (security not supported)
          conf.getInt(YarnConfiguration.SCM_ADMIN_CLIENT_THREAD_COUNT,
              YarnConfiguration.DEFAULT_SCM_ADMIN_CLIENT_THREAD_COUNT));

  // TODO: Enable service authorization (see YARN-2774)

  this.server.start();
  clientBindAddress =
      conf.updateConnectAddr(YarnConfiguration.SCM_ADMIN_ADDRESS,
          server.getListenerAddress());

  super.serviceStart();
}
 
Example 7
Source Project: XLearning   File: HistoryClientService.java    License: Apache License 2.0 5 votes vote down vote up
protected void serviceStart() throws Exception {
  Configuration conf = new XLearningConfiguration();
  YarnRPC rpc = YarnRPC.create(conf);
  initializeWebApp(conf);
  InetSocketAddress address = conf.getSocketAddr(
      XLearningConfiguration.XLEARNING_HISTORY_BIND_HOST,
      XLearningConfiguration.XLEARNING_HISTORY_ADDRESS,
      conf.get(XLearningConfiguration.XLEARNING_HISTORY_ADDRESS, XLearningConfiguration.DEFAULT_XLEARNING_HISTORY_ADDRESS),
      conf.getInt(XLearningConfiguration.XLEARNING_HISTORY_PORT, XLearningConfiguration.DEFAULT_XLEARNING_HISTORY_PORT));

  server =
      rpc.getServer(HSClientProtocol.class, protocolHandler, address,
          conf, jhsDTSecretManager,
          conf.getInt(XLearningConfiguration.XLEARNING_HISTORY_CLIENT_THREAD_COUNT,
              XLearningConfiguration.DEFAULT_XLEARNING_HISTORY_CLIENT_THREAD_COUNT));

  // Enable service authorization?
  if (conf.getBoolean(
      CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION,
      false)) {
    server.refreshServiceAcl(conf, new ClientHSPolicyProvider());
  }

  server.start();
  this.bindAddress = conf.updateConnectAddr(XLearningConfiguration.XLEARNING_HISTORY_BIND_HOST,
      XLearningConfiguration.XLEARNING_HISTORY_ADDRESS,
      conf.get(XLearningConfiguration.XLEARNING_HISTORY_ADDRESS, XLearningConfiguration.DEFAULT_XLEARNING_HISTORY_ADDRESS),
      server.getListenerAddress());
  LOG.info("Instantiated HistoryClientService at " + this.bindAddress);

  super.serviceStart();
}
 
Example 8
Source Project: hadoop   File: ResourceTrackerService.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void serviceStart() throws Exception {
  super.serviceStart();
  // ResourceTrackerServer authenticates NodeManager via Kerberos if
  // security is enabled, so no secretManager.
  Configuration conf = getConfig();
  YarnRPC rpc = YarnRPC.create(conf);
  this.server =
    rpc.getServer(ResourceTracker.class, this, resourceTrackerAddress,
        conf, null,
        conf.getInt(YarnConfiguration.RM_RESOURCE_TRACKER_CLIENT_THREAD_COUNT, 
            YarnConfiguration.DEFAULT_RM_RESOURCE_TRACKER_CLIENT_THREAD_COUNT));
  
  // Enable service authorization?
  if (conf.getBoolean(
      CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION, 
      false)) {
    InputStream inputStream =
        this.rmContext.getConfigurationProvider()
            .getConfigurationInputStream(conf,
                YarnConfiguration.HADOOP_POLICY_CONFIGURATION_FILE);
    if (inputStream != null) {
      conf.addResource(inputStream);
    }
    refreshServiceAcls(conf, RMPolicyProvider.getInstance());
  }
 
  this.server.start();
  conf.updateConnectAddr(YarnConfiguration.RM_BIND_HOST,
	   YarnConfiguration.RM_RESOURCE_TRACKER_ADDRESS,
	   YarnConfiguration.DEFAULT_RM_RESOURCE_TRACKER_ADDRESS,
                         server.getListenerAddress());
}
 
Example 9
Source Project: hadoop   File: ClientRMService.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void serviceStart() throws Exception {
  Configuration conf = getConfig();
  YarnRPC rpc = YarnRPC.create(conf);
  this.server =   
    rpc.getServer(ApplicationClientProtocol.class, this,
          clientBindAddress,
          conf, this.rmDTSecretManager,
          conf.getInt(YarnConfiguration.RM_CLIENT_THREAD_COUNT, 
              YarnConfiguration.DEFAULT_RM_CLIENT_THREAD_COUNT));
  
  // Enable service authorization?
  if (conf.getBoolean(
      CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION, 
      false)) {
    InputStream inputStream =
        this.rmContext.getConfigurationProvider()
            .getConfigurationInputStream(conf,
                YarnConfiguration.HADOOP_POLICY_CONFIGURATION_FILE);
    if (inputStream != null) {
      conf.addResource(inputStream);
    }
    refreshServiceAcls(conf, RMPolicyProvider.getInstance());
  }
  
  this.server.start();
  clientBindAddress = conf.updateConnectAddr(YarnConfiguration.RM_BIND_HOST,
                                             YarnConfiguration.RM_ADDRESS,
                                             YarnConfiguration.DEFAULT_RM_ADDRESS,
                                             server.getListenerAddress());
  super.serviceStart();
}
 
Example 10
Source Project: hadoop   File: AdminService.java    License: Apache License 2.0 5 votes vote down vote up
protected void startServer() throws Exception {
  Configuration conf = getConfig();
  YarnRPC rpc = YarnRPC.create(conf);
  this.server = (Server) rpc.getServer(
      ResourceManagerAdministrationProtocol.class, this, masterServiceBindAddress,
      conf, null,
      conf.getInt(YarnConfiguration.RM_ADMIN_CLIENT_THREAD_COUNT,
          YarnConfiguration.DEFAULT_RM_ADMIN_CLIENT_THREAD_COUNT));

  // Enable service authorization?
  if (conf.getBoolean(
      CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION,
      false)) {
    refreshServiceAcls(
        getConfiguration(conf,
            YarnConfiguration.HADOOP_POLICY_CONFIGURATION_FILE),
        RMPolicyProvider.getInstance());
  }

  if (rmContext.isHAEnabled()) {
    RPC.setProtocolEngine(conf, HAServiceProtocolPB.class,
        ProtobufRpcEngine.class);

    HAServiceProtocolServerSideTranslatorPB haServiceProtocolXlator =
        new HAServiceProtocolServerSideTranslatorPB(this);
    BlockingService haPbService =
        HAServiceProtocolProtos.HAServiceProtocolService
            .newReflectiveBlockingService(haServiceProtocolXlator);
    server.addProtocol(RPC.RpcKind.RPC_PROTOCOL_BUFFER,
        HAServiceProtocol.class, haPbService);
  }

  this.server.start();
  conf.updateConnectAddr(YarnConfiguration.RM_BIND_HOST,
                         YarnConfiguration.RM_ADMIN_ADDRESS,
                         YarnConfiguration.DEFAULT_RM_ADMIN_ADDRESS,
                         server.getListenerAddress());
}
 
Example 11
protected void serviceStart() throws Exception {
  Configuration conf = getConfig();
  YarnRPC rpc = YarnRPC.create(conf);
  InetSocketAddress address = conf.getSocketAddr(
      YarnConfiguration.TIMELINE_SERVICE_BIND_HOST,
      YarnConfiguration.TIMELINE_SERVICE_ADDRESS,
      YarnConfiguration.DEFAULT_TIMELINE_SERVICE_ADDRESS,
      YarnConfiguration.DEFAULT_TIMELINE_SERVICE_PORT);

  Preconditions.checkArgument(conf.getInt(
      YarnConfiguration.TIMELINE_SERVICE_HANDLER_THREAD_COUNT,
      YarnConfiguration.DEFAULT_TIMELINE_SERVICE_CLIENT_THREAD_COUNT) > 0,
      "%s property value should be greater than zero",
      YarnConfiguration.TIMELINE_SERVICE_HANDLER_THREAD_COUNT);

  server =
      rpc.getServer(ApplicationHistoryProtocol.class, this,
        address, conf, null, conf.getInt(
          YarnConfiguration.TIMELINE_SERVICE_HANDLER_THREAD_COUNT,
          YarnConfiguration.DEFAULT_TIMELINE_SERVICE_CLIENT_THREAD_COUNT));

  // Enable service authorization?
  if (conf.getBoolean(
      CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION, false)) {
    refreshServiceAcls(conf, new TimelinePolicyProvider());
  }

  server.start();
  this.bindAddress =
      conf.updateConnectAddr(YarnConfiguration.TIMELINE_SERVICE_BIND_HOST,
                             YarnConfiguration.TIMELINE_SERVICE_ADDRESS,
                             YarnConfiguration.DEFAULT_TIMELINE_SERVICE_ADDRESS,
                             server.getListenerAddress());
  LOG.info("Instantiated ApplicationHistoryClientService at "
      + this.bindAddress);

  super.serviceStart();
}
 
Example 12
Source Project: hadoop   File: HistoryClientService.java    License: Apache License 2.0 5 votes vote down vote up
protected void serviceStart() throws Exception {
  Configuration conf = getConfig();
  YarnRPC rpc = YarnRPC.create(conf);
  initializeWebApp(conf);
  InetSocketAddress address = conf.getSocketAddr(
      JHAdminConfig.MR_HISTORY_BIND_HOST,
      JHAdminConfig.MR_HISTORY_ADDRESS,
      JHAdminConfig.DEFAULT_MR_HISTORY_ADDRESS,
      JHAdminConfig.DEFAULT_MR_HISTORY_PORT);

  server =
      rpc.getServer(HSClientProtocol.class, protocolHandler, address,
          conf, jhsDTSecretManager,
          conf.getInt(JHAdminConfig.MR_HISTORY_CLIENT_THREAD_COUNT,
              JHAdminConfig.DEFAULT_MR_HISTORY_CLIENT_THREAD_COUNT));

  // Enable service authorization?
  if (conf.getBoolean(
      CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION,
      false)) {
    server.refreshServiceAcl(conf, new ClientHSPolicyProvider());
  }
  
  server.start();
  this.bindAddress = conf.updateConnectAddr(JHAdminConfig.MR_HISTORY_BIND_HOST,
                                            JHAdminConfig.MR_HISTORY_ADDRESS,
                                            JHAdminConfig.DEFAULT_MR_HISTORY_ADDRESS,
                                            server.getListenerAddress());
  LOG.info("Instantiated HistoryClientService at " + this.bindAddress);

  super.serviceStart();
}
 
Example 13
Source Project: big-c   File: ResourceTrackerService.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void serviceStart() throws Exception {
  super.serviceStart();
  // ResourceTrackerServer authenticates NodeManager via Kerberos if
  // security is enabled, so no secretManager.
  Configuration conf = getConfig();
  YarnRPC rpc = YarnRPC.create(conf);
  this.server =
    rpc.getServer(ResourceTracker.class, this, resourceTrackerAddress,
        conf, null,
        conf.getInt(YarnConfiguration.RM_RESOURCE_TRACKER_CLIENT_THREAD_COUNT, 
            YarnConfiguration.DEFAULT_RM_RESOURCE_TRACKER_CLIENT_THREAD_COUNT));
  
  // Enable service authorization?
  if (conf.getBoolean(
      CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION, 
      false)) {
    InputStream inputStream =
        this.rmContext.getConfigurationProvider()
            .getConfigurationInputStream(conf,
                YarnConfiguration.HADOOP_POLICY_CONFIGURATION_FILE);
    if (inputStream != null) {
      conf.addResource(inputStream);
    }
    refreshServiceAcls(conf, RMPolicyProvider.getInstance());
  }
 
  this.server.start();
  conf.updateConnectAddr(YarnConfiguration.RM_BIND_HOST,
	   YarnConfiguration.RM_RESOURCE_TRACKER_ADDRESS,
	   YarnConfiguration.DEFAULT_RM_RESOURCE_TRACKER_ADDRESS,
                         server.getListenerAddress());
}
 
Example 14
Source Project: big-c   File: ClientRMService.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void serviceStart() throws Exception {
  Configuration conf = getConfig();
  YarnRPC rpc = YarnRPC.create(conf);
  this.server =   
    rpc.getServer(ApplicationClientProtocol.class, this,
          clientBindAddress,
          conf, this.rmDTSecretManager,
          conf.getInt(YarnConfiguration.RM_CLIENT_THREAD_COUNT, 
              YarnConfiguration.DEFAULT_RM_CLIENT_THREAD_COUNT));
  
  // Enable service authorization?
  if (conf.getBoolean(
      CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION, 
      false)) {
    InputStream inputStream =
        this.rmContext.getConfigurationProvider()
            .getConfigurationInputStream(conf,
                YarnConfiguration.HADOOP_POLICY_CONFIGURATION_FILE);
    if (inputStream != null) {
      conf.addResource(inputStream);
    }
    refreshServiceAcls(conf, RMPolicyProvider.getInstance());
  }
  
  this.server.start();
  clientBindAddress = conf.updateConnectAddr(YarnConfiguration.RM_BIND_HOST,
                                             YarnConfiguration.RM_ADDRESS,
                                             YarnConfiguration.DEFAULT_RM_ADDRESS,
                                             server.getListenerAddress());
  super.serviceStart();
}
 
Example 15
Source Project: big-c   File: AdminService.java    License: Apache License 2.0 5 votes vote down vote up
protected void startServer() throws Exception {
  Configuration conf = getConfig();
  YarnRPC rpc = YarnRPC.create(conf);
  this.server = (Server) rpc.getServer(
      ResourceManagerAdministrationProtocol.class, this, masterServiceBindAddress,
      conf, null,
      conf.getInt(YarnConfiguration.RM_ADMIN_CLIENT_THREAD_COUNT,
          YarnConfiguration.DEFAULT_RM_ADMIN_CLIENT_THREAD_COUNT));

  // Enable service authorization?
  if (conf.getBoolean(
      CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION,
      false)) {
    refreshServiceAcls(
        getConfiguration(conf,
            YarnConfiguration.HADOOP_POLICY_CONFIGURATION_FILE),
        RMPolicyProvider.getInstance());
  }

  if (rmContext.isHAEnabled()) {
    RPC.setProtocolEngine(conf, HAServiceProtocolPB.class,
        ProtobufRpcEngine.class);

    HAServiceProtocolServerSideTranslatorPB haServiceProtocolXlator =
        new HAServiceProtocolServerSideTranslatorPB(this);
    BlockingService haPbService =
        HAServiceProtocolProtos.HAServiceProtocolService
            .newReflectiveBlockingService(haServiceProtocolXlator);
    server.addProtocol(RPC.RpcKind.RPC_PROTOCOL_BUFFER,
        HAServiceProtocol.class, haPbService);
  }

  this.server.start();
  conf.updateConnectAddr(YarnConfiguration.RM_BIND_HOST,
                         YarnConfiguration.RM_ADMIN_ADDRESS,
                         YarnConfiguration.DEFAULT_RM_ADMIN_ADDRESS,
                         server.getListenerAddress());
}
 
Example 16
protected void serviceStart() throws Exception {
  Configuration conf = getConfig();
  YarnRPC rpc = YarnRPC.create(conf);
  InetSocketAddress address = conf.getSocketAddr(
      YarnConfiguration.TIMELINE_SERVICE_BIND_HOST,
      YarnConfiguration.TIMELINE_SERVICE_ADDRESS,
      YarnConfiguration.DEFAULT_TIMELINE_SERVICE_ADDRESS,
      YarnConfiguration.DEFAULT_TIMELINE_SERVICE_PORT);

  Preconditions.checkArgument(conf.getInt(
      YarnConfiguration.TIMELINE_SERVICE_HANDLER_THREAD_COUNT,
      YarnConfiguration.DEFAULT_TIMELINE_SERVICE_CLIENT_THREAD_COUNT) > 0,
      "%s property value should be greater than zero",
      YarnConfiguration.TIMELINE_SERVICE_HANDLER_THREAD_COUNT);

  server =
      rpc.getServer(ApplicationHistoryProtocol.class, this,
        address, conf, null, conf.getInt(
          YarnConfiguration.TIMELINE_SERVICE_HANDLER_THREAD_COUNT,
          YarnConfiguration.DEFAULT_TIMELINE_SERVICE_CLIENT_THREAD_COUNT));

  // Enable service authorization?
  if (conf.getBoolean(
      CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION, false)) {
    refreshServiceAcls(conf, new TimelinePolicyProvider());
  }

  server.start();
  this.bindAddress =
      conf.updateConnectAddr(YarnConfiguration.TIMELINE_SERVICE_BIND_HOST,
                             YarnConfiguration.TIMELINE_SERVICE_ADDRESS,
                             YarnConfiguration.DEFAULT_TIMELINE_SERVICE_ADDRESS,
                             server.getListenerAddress());
  LOG.info("Instantiated ApplicationHistoryClientService at "
      + this.bindAddress);

  super.serviceStart();
}
 
Example 17
Source Project: big-c   File: HistoryClientService.java    License: Apache License 2.0 5 votes vote down vote up
protected void serviceStart() throws Exception {
  Configuration conf = getConfig();
  YarnRPC rpc = YarnRPC.create(conf);
  initializeWebApp(conf);
  InetSocketAddress address = conf.getSocketAddr(
      JHAdminConfig.MR_HISTORY_BIND_HOST,
      JHAdminConfig.MR_HISTORY_ADDRESS,
      JHAdminConfig.DEFAULT_MR_HISTORY_ADDRESS,
      JHAdminConfig.DEFAULT_MR_HISTORY_PORT);

  server =
      rpc.getServer(HSClientProtocol.class, protocolHandler, address,
          conf, jhsDTSecretManager,
          conf.getInt(JHAdminConfig.MR_HISTORY_CLIENT_THREAD_COUNT,
              JHAdminConfig.DEFAULT_MR_HISTORY_CLIENT_THREAD_COUNT));

  // Enable service authorization?
  if (conf.getBoolean(
      CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION,
      false)) {
    server.refreshServiceAcl(conf, new ClientHSPolicyProvider());
  }
  
  server.start();
  this.bindAddress = conf.updateConnectAddr(JHAdminConfig.MR_HISTORY_BIND_HOST,
                                            JHAdminConfig.MR_HISTORY_ADDRESS,
                                            JHAdminConfig.DEFAULT_MR_HISTORY_ADDRESS,
                                            server.getListenerAddress());
  LOG.info("Instantiated HistoryClientService at " + this.bindAddress);

  super.serviceStart();
}