當前位置: 首頁>>代碼示例>>Java>>正文


Java TokenCache.setShuffleSecretKey方法代碼示例

本文整理匯總了Java中org.apache.hadoop.mapreduce.security.TokenCache.setShuffleSecretKey方法的典型用法代碼示例。如果您正苦於以下問題:Java TokenCache.setShuffleSecretKey方法的具體用法?Java TokenCache.setShuffleSecretKey怎麽用?Java TokenCache.setShuffleSecretKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.mapreduce.security.TokenCache的用法示例。


在下文中一共展示了TokenCache.setShuffleSecretKey方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setup

import org.apache.hadoop.mapreduce.security.TokenCache; //導入方法依賴的package包/類
protected void setup(JobImpl job) throws IOException {

      String oldJobIDString = job.oldJobId.toString();
      String user = 
        UserGroupInformation.getCurrentUser().getShortUserName();
      Path path = MRApps.getStagingAreaDir(job.conf, user);
      if(LOG.isDebugEnabled()) {
        LOG.debug("startJobs: parent=" + path + " child=" + oldJobIDString);
      }

      job.remoteJobSubmitDir =
          FileSystem.get(job.conf).makeQualified(
              new Path(path, oldJobIDString));
      job.remoteJobConfFile =
          new Path(job.remoteJobSubmitDir, MRJobConfig.JOB_CONF_FILE);

      // Prepare the TaskAttemptListener server for authentication of Containers
      // TaskAttemptListener gets the information via jobTokenSecretManager.
      JobTokenIdentifier identifier =
          new JobTokenIdentifier(new Text(oldJobIDString));
      job.jobToken =
          new Token<JobTokenIdentifier>(identifier, job.jobTokenSecretManager);
      job.jobToken.setService(identifier.getJobId());
      // Add it to the jobTokenSecretManager so that TaskAttemptListener server
      // can authenticate containers(tasks)
      job.jobTokenSecretManager.addTokenForJob(oldJobIDString, job.jobToken);
      LOG.info("Adding job token for " + oldJobIDString
          + " to jobTokenSecretManager");

      // If the job client did not setup the shuffle secret then reuse
      // the job token secret for the shuffle.
      if (TokenCache.getShuffleSecretKey(job.jobCredentials) == null) {
        LOG.warn("Shuffle secret key missing from job credentials."
            + " Using job token secret as shuffle secret.");
        TokenCache.setShuffleSecretKey(job.jobToken.getPassword(),
            job.jobCredentials);
      }
    }
 
開發者ID:naver,項目名稱:hadoop,代碼行數:39,代碼來源:JobImpl.java

示例2: testEncryptedMerger

import org.apache.hadoop.mapreduce.security.TokenCache; //導入方法依賴的package包/類
@Test
public void testEncryptedMerger() throws Throwable {
  jobConf.setBoolean(MRJobConfig.MR_ENCRYPTED_INTERMEDIATE_DATA, true);
  conf.setBoolean(MRJobConfig.MR_ENCRYPTED_INTERMEDIATE_DATA, true);
  Credentials credentials = UserGroupInformation.getCurrentUser().getCredentials();
  TokenCache.setShuffleSecretKey(new byte[16], credentials);
  UserGroupInformation.getCurrentUser().addCredentials(credentials);
  testInMemoryAndOnDiskMerger();
}
 
開發者ID:Nextzero,項目名稱:hadoop-2.6.0-cdh5.4.3,代碼行數:10,代碼來源:TestMerger.java

示例3: initJobCredentialsAndUGI

import org.apache.hadoop.mapreduce.security.TokenCache; //導入方法依賴的package包/類
@Override
protected void initJobCredentialsAndUGI(Configuration conf) {
  // Fake a shuffle secret that normally is provided by the job client.
  String shuffleSecret = "fake-shuffle-secret";
  TokenCache.setShuffleSecretKey(shuffleSecret.getBytes(), getCredentials());
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:7,代碼來源:MRApp.java


注:本文中的org.apache.hadoop.mapreduce.security.TokenCache.setShuffleSecretKey方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。