Example usage for org.apache.hadoop.mapreduce MRJobConfig JOB_NAMENODES

List of usage examples for org.apache.hadoop.mapreduce MRJobConfig JOB_NAMENODES

Introduction

In this page you can find the example usage for org.apache.hadoop.mapreduce MRJobConfig JOB_NAMENODES.

Prototype

String JOB_NAMENODES

To view the source code for org.apache.hadoop.mapreduce MRJobConfig JOB_NAMENODES.

Click Source Link

Usage

From source file:org.apache.oozie.action.hadoop.HDFSCredentials.java

License:Apache License

/**
 * Add an HDFS_DELEGATION_TOKEN to the {@link Credentials} provided.
 * This is also important to ensure that log aggregation works correctly from the NM
 *
 * @param credentials the credentials object which is updated
 * @param config launcher AM configuration
 * @param props properties for getting credential token or certificate
 * @param context workflow context/*from w  ww.ja  va 2  s  . c o m*/
 * @throws Exception thrown if failed
 */
@Override
public void updateCredentials(Credentials credentials, Configuration config, CredentialsProperties props,
        ActionExecutor.Context context) throws Exception {
    final String jobNameNodes[] = config.getStrings(MRJobConfig.JOB_NAMENODES);
    if (jobNameNodes != null) {
        final Path[] paths = new Path[jobNameNodes.length];
        for (int i = 0; i != jobNameNodes.length; ++i) {
            paths[i] = new Path(jobNameNodes[i]);
        }

        final UserGroupInformation ugi = Services.get().get(UserGroupInformationService.class)
                .getProxyUser(context.getWorkflow().getUser());
        obtainTokensForNamenodes(credentials, config, ugi, paths);
    } else {
        obtainTokenForAppFileSystemNameNode(credentials, config, context);
    }

}

From source file:org.apache.oozie.action.hadoop.HDFSCredentials.java

License:Apache License

private void obtainTokensForNamenodes(final Credentials credentials, final Configuration config,
        final UserGroupInformation ugi, final Path[] paths) throws IOException, InterruptedException {
    LOG.info(String.format("\"%s\" is present in workflow configuration. Obtaining tokens for NameNode(s) [%s]",
            MRJobConfig.JOB_NAMENODES, config.get(MRJobConfig.JOB_NAMENODES)));
    ugi.doAs(new PrivilegedExceptionAction<Void>() {
        @Override/*from w  ww  . ja v a2s  .  c  o  m*/
        public Void run() throws Exception {
            TokenCache.obtainTokensForNamenodes(credentials, paths, config);
            return null;
        }
    });
}

From source file:org.apache.pig.backend.hadoop.executionengine.tez.util.SecurityHelper.java

License:Apache License

public static void populateTokenCache(Configuration conf, Credentials credentials) throws IOException {
    readTokensFromFiles(conf, credentials);
    // add the delegation tokens from configuration
    String[] nameNodes = conf.getStrings(MRJobConfig.JOB_NAMENODES);
    LOG.debug("adding the following namenodes' delegation tokens:" + Arrays.toString(nameNodes));
    if (nameNodes != null) {
        Path[] ps = new Path[nameNodes.length];
        for (int i = 0; i < nameNodes.length; i++) {
            ps[i] = new Path(nameNodes[i]);
        }/*w w w. j  av  a  2s.  c om*/
        TokenCache.obtainTokensForNamenodes(credentials, ps, conf);
    }
}