当前位置: 首页>>代码示例>>Java>>正文


Java Master类代码示例

本文整理汇总了Java中org.apache.hadoop.mapred.Master的典型用法代码示例。如果您正苦于以下问题:Java Master类的具体用法?Java Master怎么用?Java Master使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Master类属于org.apache.hadoop.mapred包,在下文中一共展示了Master类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: obtainTokensForNamenodesInternal

import org.apache.hadoop.mapred.Master; //导入依赖的package包/类
/**
 * get delegation token for a specific FS
 * @param fs
 * @param credentials
 * @param p
 * @param conf
 * @throws IOException
 */
static void obtainTokensForNamenodesInternal(FileSystem fs, 
    Credentials credentials, Configuration conf) throws IOException {
  String delegTokenRenewer = Master.getMasterPrincipal(conf);
  if (delegTokenRenewer == null || delegTokenRenewer.length() == 0) {
    throw new IOException(
        "Can't get Master Kerberos principal for use as renewer");
  }
  mergeBinaryTokens(credentials, conf);

  final Token<?> tokens[] = fs.addDelegationTokens(delegTokenRenewer,
                                                   credentials);
  if (tokens != null) {
    for (Token<?> token : tokens) {
      LOG.info("Got dt for " + fs.getUri() + "; "+token);
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:TokenCache.java

示例2: testSingleTokenFetch

import org.apache.hadoop.mapred.Master; //导入依赖的package包/类
@Test
public void testSingleTokenFetch() throws Exception {
  Configuration conf = new Configuration();
  conf.set(YarnConfiguration.RM_PRINCIPAL, "mapred/[email protected]");
  String renewer = Master.getMasterPrincipal(conf);
  Credentials credentials = new Credentials();
  
  final MockFileSystem fs = new MockFileSystem();
  final MockFileSystem mockFs = (MockFileSystem) fs.getRawFileSystem();
  when(mockFs.getCanonicalServiceName()).thenReturn("host:0");
  when(mockFs.getUri()).thenReturn(new URI("mockfs://host:0"));
  
  Path mockPath = mock(Path.class);
  when(mockPath.getFileSystem(conf)).thenReturn(mockFs);
  
  Path[] paths = new Path[]{ mockPath, mockPath };
  when(mockFs.addDelegationTokens("me", credentials)).thenReturn(null);
  TokenCache.obtainTokensForNamenodesInternal(credentials, paths, conf);
  verify(mockFs, times(1)).addDelegationTokens(renewer, credentials);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestTokenCache.java

示例3: obtainTokensForNamenodesInternal

import org.apache.hadoop.mapred.Master; //导入依赖的package包/类
/**
 * get delegation token for a specific FS
 * @param fs
 * @param credentials
 * @param conf
 * @throws IOException
 */
static void obtainTokensForNamenodesInternal(FileSystem fs, 
    Credentials credentials, Configuration conf) throws IOException {
  // RM skips renewing token with empty renewer
  String delegTokenRenewer = "";
  if (!isTokenRenewalExcluded(fs, conf)) {
    delegTokenRenewer = Master.getMasterPrincipal(conf);
    if (delegTokenRenewer == null || delegTokenRenewer.length() == 0) {
      throw new IOException(
          "Can't get Master Kerberos principal for use as renewer");
    }
  }

  mergeBinaryTokens(credentials, conf);

  final Token<?> tokens[] = fs.addDelegationTokens(delegTokenRenewer,
                                                   credentials);
  if (tokens != null) {
    for (Token<?> token : tokens) {
      LOG.info("Got dt for " + fs.getUri() + "; "+token);
    }
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:30,代码来源:TokenCache.java

示例4: obtainTokensForNamenodesInternal

import org.apache.hadoop.mapred.Master; //导入依赖的package包/类
/**
 * get delegation token for a specific FS
 * @param fs
 * @param credentials
 * @param p
 * @param conf
 * @throws IOException
 */
static void obtainTokensForNamenodesInternal(FileSystem fs, 
    Credentials credentials, Configuration conf) throws IOException {
  // RM skips renewing token with empty renewer
  String delegTokenRenewer = "";
  if (!isTokenRenewalExcluded(fs, conf)) {
    delegTokenRenewer = Master.getMasterPrincipal(conf);
    if (delegTokenRenewer == null || delegTokenRenewer.length() == 0) {
      throw new IOException(
          "Can't get Master Kerberos principal for use as renewer");
    }
  }

  mergeBinaryTokens(credentials, conf);

  final Token<?> tokens[] = fs.addDelegationTokens(delegTokenRenewer,
                                                   credentials);
  if (tokens != null) {
    for (Token<?> token : tokens) {
      LOG.info("Got dt for " + fs.getUri() + "; "+token);
    }
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:31,代码来源:TokenCache.java

示例5: testSingleTokenFetch

import org.apache.hadoop.mapred.Master; //导入依赖的package包/类
@Test
public void testSingleTokenFetch() throws Exception {
  Configuration conf = new Configuration();
  conf.set(YarnConfiguration.RM_PRINCIPAL, "mapred/host[email protected]");
  String renewer = Master.getMasterPrincipal(conf);
  Credentials credentials = new Credentials();
  
  final MockFileSystem fs = new MockFileSystem();
  final MockFileSystem mockFs = (MockFileSystem) fs.getRawFileSystem();
  when(mockFs.getCanonicalServiceName()).thenReturn("host:0");
  when(mockFs.getUri()).thenReturn(new URI("mockfs://host:0"));
  
  Path mockPath = mock(Path.class);
  when(mockPath.getFileSystem(conf)).thenReturn(mockFs);
  
  Path[] paths = new Path[]{ mockPath, mockPath };
  when(mockFs.addDelegationTokens("me", credentials)).thenReturn(null);
  TokenCache.obtainTokensForNamenodesInternal(credentials, paths, conf);
  verify(mockFs, times(1)).addDelegationTokens(renewer, credentials);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:21,代码来源:TestTokenCache.java

示例6: getDelegationTokenFromHS

import org.apache.hadoop.mapred.Master; //导入依赖的package包/类
private static Token<?> getDelegationTokenFromHS(HSClientProtocol hsProxy, Configuration conf) throws IOException {
  GetDelegationTokenRequest request =
      RecordFactoryProvider.getRecordFactory(null).newRecordInstance(GetDelegationTokenRequest.class);
  request.setRenewer(Master.getMasterPrincipal(conf));
  org.apache.hadoop.yarn.api.records.Token mrDelegationToken;
  mrDelegationToken = hsProxy.getDelegationToken(request).getDelegationToken();
  return ConverterUtils.convertFromYarn(mrDelegationToken, hsProxy.getConnectAddress());
}
 
开发者ID:apache,项目名称:incubator-gobblin,代码行数:9,代码来源:TokenUtils.java

示例7: getDelegationTokenFromHS

import org.apache.hadoop.mapred.Master; //导入依赖的package包/类
private Token<?> getDelegationTokenFromHS(HSClientProtocol hsProxy)
    throws IOException, InterruptedException {
  GetDelegationTokenRequest request =
      recordFactory.newRecordInstance(GetDelegationTokenRequest.class);
  request.setRenewer(Master.getMasterPrincipal(conf));
  org.apache.hadoop.yarn.api.records.Token mrDelegationToken;
  mrDelegationToken =
      hsProxy.getDelegationToken(request).getDelegationToken();
  return ConverterUtils.convertFromYarn(mrDelegationToken,
      hsProxy.getConnectAddress());
}
 
开发者ID:azkaban,项目名称:azkaban-plugins,代码行数:12,代码来源:HadoopSecurityManager_H_2_0.java

示例8: setup

import org.apache.hadoop.mapred.Master; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception {
  conf = new Configuration();
  conf.set(YarnConfiguration.RM_PRINCIPAL, "mapred/[email protected]");
  renewer = Master.getMasterPrincipal(conf);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:7,代码来源:TestTokenCache.java


注:本文中的org.apache.hadoop.mapred.Master类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。