List of usage examples for org.apache.hadoop.yarn.conf YarnConfiguration DEFAULT_RM_ADDRESS
String DEFAULT_RM_ADDRESS
To view the source code for org.apache.hadoop.yarn.conf YarnConfiguration DEFAULT_RM_ADDRESS.
Click Source Link
From source file:org.apache.tez.common.security.Master.java
License:Apache License
public static InetSocketAddress getMasterAddress(Configuration conf) { return conf.getSocketAddr(YarnConfiguration.RM_ADDRESS, YarnConfiguration.DEFAULT_RM_ADDRESS, YarnConfiguration.DEFAULT_RM_PORT); }
From source file:org.apache.tez.mapreduce.client.ResourceMgrDelegate.java
License:Apache License
/** * Delegate responsible for communicating with the Resource Manager's {@link ApplicationClientProtocol}. * @param conf the configuration object. *//* w w w .j a v a 2s . c o m*/ public ResourceMgrDelegate(YarnConfiguration conf) { super(); this.conf = conf; client = YarnClient.createYarnClient(); client.init(conf); this.rmAddress = conf.getSocketAddr(YarnConfiguration.RM_ADDRESS, YarnConfiguration.DEFAULT_RM_ADDRESS, YarnConfiguration.DEFAULT_RM_PORT); client.start(); }
From source file:org.apache.twill.internal.yarn.Hadoop23YarnAppClient.java
License:Apache License
/** * Overrides parent method to adds RM delegation token to the given context. If YARN is running with HA RM, * delegation tokens for each RM service will be added. *//*from w w w . ja v a2s. c o m*/ protected void addRMToken(ContainerLaunchContext context, YarnClient yarnClient, ApplicationId appId) { if (!UserGroupInformation.isSecurityEnabled()) { return; } try { Text renewer = new Text(UserGroupInformation.getCurrentUser().getShortUserName()); org.apache.hadoop.yarn.api.records.Token rmDelegationToken = yarnClient.getRMDelegationToken(renewer); // The following logic is copied from ClientRMProxy.getRMDelegationTokenService, which is not available in // YARN older than 2.4 List<String> services = new ArrayList<>(); if (HAUtil.isHAEnabled(configuration)) { // If HA is enabled, we need to enumerate all RM hosts // and add the corresponding service name to the token service // Copy the yarn conf since we need to modify it to get the RM addresses YarnConfiguration yarnConf = new YarnConfiguration(configuration); for (String rmId : HAUtil.getRMHAIds(configuration)) { yarnConf.set(YarnConfiguration.RM_HA_ID, rmId); InetSocketAddress address = yarnConf.getSocketAddr(YarnConfiguration.RM_ADDRESS, YarnConfiguration.DEFAULT_RM_ADDRESS, YarnConfiguration.DEFAULT_RM_PORT); services.add(SecurityUtil.buildTokenService(address).toString()); } } else { services.add(SecurityUtil.buildTokenService(YarnUtils.getRMAddress(configuration)).toString()); } Credentials credentials = YarnUtils.decodeCredentials(context.getTokens()); // casting needed for later Hadoop version @SuppressWarnings("RedundantCast") Token<TokenIdentifier> token = ConverterUtils.convertFromYarn(rmDelegationToken, (InetSocketAddress) null); token.setService(new Text(Joiner.on(',').join(services))); credentials.addToken(new Text(token.getService()), token); LOG.debug("Added RM delegation token {} for application {}", token, appId); credentials.addToken(token.getService(), token); context.setTokens(YarnUtils.encodeCredentials(credentials)); } catch (Exception e) { throw Throwables.propagate(e); } }
From source file:org.apache.twill.internal.yarn.YarnUtils.java
License:Apache License
public static InetSocketAddress getRMAddress(Configuration config) { return config.getSocketAddr(YarnConfiguration.RM_ADDRESS, YarnConfiguration.DEFAULT_RM_ADDRESS, YarnConfiguration.DEFAULT_RM_PORT); }
From source file:org.deeplearning4j.iterativereduce.runtime.yarn.ResourceManagerHandler.java
License:Apache License
public ClientRMProtocol getClientResourceManager() { if (clientResourceManager != null) return clientResourceManager; YarnConfiguration yarnConf = new YarnConfiguration(conf); YarnRPC rpc = YarnRPC.create(yarnConf); InetSocketAddress rmAddress = NetUtils .createSocketAddr(yarnConf.get(YarnConfiguration.RM_ADDRESS, YarnConfiguration.DEFAULT_RM_ADDRESS)); LOG.info("Connecting to the resource manager (client) at " + rmAddress); clientResourceManager = (ClientRMProtocol) rpc.getProxy(ClientRMProtocol.class, rmAddress, conf); return clientResourceManager; }
From source file:org.huahinframework.manager.rest.service.ApplicationService.java
License:Apache License
/** * init/* w ww . j av a 2 s. c om*/ */ public void init() { YarnRPC rpc = YarnRPC.create(getJobConf()); YarnConfiguration yarnConf = new YarnConfiguration(getJobConf()); InetSocketAddress rmAddress = NetUtils .createSocketAddr(yarnConf.get(YarnConfiguration.RM_ADDRESS, YarnConfiguration.DEFAULT_RM_ADDRESS)); applicationsManager = ((ClientRMProtocol) rpc.getProxy(ClientRMProtocol.class, rmAddress, yarnConf)); recordFactory = RecordFactoryProvider.getRecordFactory(yarnConf); }
From source file:org.springframework.yarn.client.ClientRmTemplate.java
License:Apache License
@Override protected InetSocketAddress getRpcAddress(Configuration config) { return config.getSocketAddr(YarnConfiguration.RM_ADDRESS, YarnConfiguration.DEFAULT_RM_ADDRESS, YarnConfiguration.DEFAULT_RM_PORT); }
From source file:org.springframework.yarn.support.YarnUtils.java
License:Apache License
/** * Gets the address./*from w w w. j a v a 2 s .co m*/ * * @param conf the Yarn configuration * @return the address */ public static InetSocketAddress getAddress(Configuration conf) { return conf.getSocketAddr(YarnConfiguration.RM_ADDRESS, YarnConfiguration.DEFAULT_RM_ADDRESS, YarnConfiguration.DEFAULT_RM_PORT); }