org.apache.hadoop.registry.client.api.RegistryConstants Java Examples

The following examples show how to use org.apache.hadoop.registry.client.api.RegistryConstants. 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 check out the related API usage on the sidebar.
Example #1
Source File: YarnZkRegistryBusiness.java    From PoseidonX with Apache License 2.0 6 votes vote down vote up
private static void initAndStart(){
    try{
        Configuration conf  = new YarnConfiguration();
        conf.set(RegistryConstants.KEY_REGISTRY_ZK_ROOT, YarnZkContant.ZK_AM_REGISTRY_ROOT);
        registryOperations = RegistryOperationsFactory.createInstance(YarnZkContant.ZK_AM_REGISTRY_JSTORM_YARN, conf);
        if (registryOperations instanceof RMRegistryOperationsService) {
            RMRegistryOperationsService rmRegOperations = (RMRegistryOperationsService) registryOperations;
            rmRegOperations.initUserRegistryAsync(StreamContant.HADOOP_USER_NAME);
        }
    }catch(Exception e){
    }
    if(registryOperations==null){
        throw new IllegalArgumentException("YarnZkClientBusiness registryOperations start is error,cann't connect yarn zk!!");
    }
    registryOperations.start();
}
 
Example #2
Source File: RegistryUtils.java    From hadoop with Apache License 2.0 6 votes vote down vote up
/**
 * Buld the user path -switches to the system path if the user is "".
 * It also cross-converts the username to ascii via punycode
 * @param username username or ""
 * @return the path to the user
 */
public static String homePathForUser(String username) {
  Preconditions.checkArgument(username != null, "null user");

  // catch recursion
  if (username.startsWith(RegistryConstants.PATH_USERS)) {
    return username;
  }
  if (username.isEmpty()) {
    return RegistryConstants.PATH_SYSTEM_SERVICES;
  }

  // convert username to registry name
  String convertedName = convertUsername(username);

  return RegistryPathUtils.join(RegistryConstants.PATH_USERS,
      encodeForRegistry(convertedName));
}
 
Example #3
Source File: RegistryUtils.java    From big-c with Apache License 2.0 6 votes vote down vote up
/**
 * Buld the user path -switches to the system path if the user is "".
 * It also cross-converts the username to ascii via punycode
 * @param username username or ""
 * @return the path to the user
 */
public static String homePathForUser(String username) {
  Preconditions.checkArgument(username != null, "null user");

  // catch recursion
  if (username.startsWith(RegistryConstants.PATH_USERS)) {
    return username;
  }
  if (username.isEmpty()) {
    return RegistryConstants.PATH_SYSTEM_SERVICES;
  }

  // convert username to registry name
  String convertedName = convertUsername(username);

  return RegistryPathUtils.join(RegistryConstants.PATH_USERS,
      encodeForRegistry(convertedName));
}
 
Example #4
Source File: RegistryUtils.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * Create a service classpath
 * @param user username or ""
 * @param serviceClass service name
 * @return a full path
 */
public static String serviceclassPath(String user,
    String serviceClass) {
  String services = join(homePathForUser(user),
      RegistryConstants.PATH_USER_SERVICES);
  return join(services,
      serviceClass);
}
 
Example #5
Source File: AbstractZKRegistryTest.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public YarnConfiguration createRegistryConfiguration() {
  YarnConfiguration conf = new YarnConfiguration();
  conf.setInt(RegistryConstants.KEY_REGISTRY_ZK_CONNECTION_TIMEOUT, 1000);
  conf.setInt(RegistryConstants.KEY_REGISTRY_ZK_RETRY_INTERVAL, 500);
  conf.setInt(RegistryConstants.KEY_REGISTRY_ZK_RETRY_TIMES, 10);
  conf.setInt(RegistryConstants.KEY_REGISTRY_ZK_RETRY_CEILING, 10);
  conf.set(RegistryConstants.KEY_REGISTRY_ZK_QUORUM,
      zookeeper.getConnectionString());
  return conf;
}
 
Example #6
Source File: TestSecureRMRegistryOperations.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Before
public void setupTestSecureRMRegistryOperations() throws Exception {
  startSecureZK();
  secureConf = new Configuration();
  secureConf.setBoolean(KEY_REGISTRY_SECURE, true);

  // create client conf containing the ZK quorum
  zkClientConf = new Configuration(secureZK.getConfig());
  zkClientConf.setBoolean(KEY_REGISTRY_SECURE, true);
  assertNotEmpty(zkClientConf.get(RegistryConstants.KEY_REGISTRY_ZK_QUORUM));

  // ZK is in charge
  secureConf.set(KEY_REGISTRY_SYSTEM_ACCOUNTS, "sasl:zookeeper@");
  zookeeperUGI = loginUGI(ZOOKEEPER, keytab_zk);
}
 
Example #7
Source File: RegistryUtils.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * Create a service classpath
 * @param user username or ""
 * @param serviceClass service name
 * @return a full path
 */
public static String serviceclassPath(String user,
    String serviceClass) {
  String services = join(homePathForUser(user),
      RegistryConstants.PATH_USER_SERVICES);
  return join(services,
      serviceClass);
}
 
Example #8
Source File: AbstractZKRegistryTest.java    From big-c with Apache License 2.0 5 votes vote down vote up
public YarnConfiguration createRegistryConfiguration() {
  YarnConfiguration conf = new YarnConfiguration();
  conf.setInt(RegistryConstants.KEY_REGISTRY_ZK_CONNECTION_TIMEOUT, 1000);
  conf.setInt(RegistryConstants.KEY_REGISTRY_ZK_RETRY_INTERVAL, 500);
  conf.setInt(RegistryConstants.KEY_REGISTRY_ZK_RETRY_TIMES, 10);
  conf.setInt(RegistryConstants.KEY_REGISTRY_ZK_RETRY_CEILING, 10);
  conf.set(RegistryConstants.KEY_REGISTRY_ZK_QUORUM,
      zookeeper.getConnectionString());
  return conf;
}
 
Example #9
Source File: TestSecureRMRegistryOperations.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Before
public void setupTestSecureRMRegistryOperations() throws Exception {
  startSecureZK();
  secureConf = new Configuration();
  secureConf.setBoolean(KEY_REGISTRY_SECURE, true);

  // create client conf containing the ZK quorum
  zkClientConf = new Configuration(secureZK.getConfig());
  zkClientConf.setBoolean(KEY_REGISTRY_SECURE, true);
  assertNotEmpty(zkClientConf.get(RegistryConstants.KEY_REGISTRY_ZK_QUORUM));

  // ZK is in charge
  secureConf.set(KEY_REGISTRY_SYSTEM_ACCOUNTS, "sasl:zookeeper@");
  zookeeperUGI = loginUGI(ZOOKEEPER, keytab_zk);
}
 
Example #10
Source File: YarnRegistryViewForProviders.java    From jstorm with Apache License 2.0 5 votes vote down vote up
/**
 * Get the absolute path to where the service has registered itself.
 * This includes the base registry path
 * Null until the service is registered
 * @return the service registration path.
 */
public String getAbsoluteSelfRegistrationPath() {
  if (selfRegistrationPath == null) {
    return null;
  }
  String root = registryOperations.getConfig().getTrimmed(
      RegistryConstants.KEY_REGISTRY_ZK_ROOT,
      RegistryConstants.DEFAULT_ZK_REGISTRY_ROOT);
  return RegistryPathUtils.join(root, selfRegistrationPath);
}
 
Example #11
Source File: TestRegistrySecurityHelper.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Test
public void testDefaultAClsValid() throws Throwable {
  registrySecurity.buildACLs(
      RegistryConstants.DEFAULT_REGISTRY_SYSTEM_ACCOUNTS,
      REALM_EXAMPLE_COM, ZooDefs.Perms.ALL);
}
 
Example #12
Source File: TestRegistrySecurityHelper.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Test
public void testDefaultAClsValid() throws Throwable {
  registrySecurity.buildACLs(
      RegistryConstants.DEFAULT_REGISTRY_SYSTEM_ACCOUNTS,
      REALM_EXAMPLE_COM, ZooDefs.Perms.ALL);
}
 
Example #13
Source File: RegistryUtils.java    From hadoop with Apache License 2.0 3 votes vote down vote up
/**
 * Create a path for listing components under a service
 * @param user username or ""
 * @param serviceClass service name
 * @param serviceName service name unique for that user and service class
 * @return a full path
 */
public static String componentListPath(String user,
    String serviceClass, String serviceName) {

  return join(servicePath(user, serviceClass, serviceName),
      RegistryConstants.SUBPATH_COMPONENTS);
}
 
Example #14
Source File: RegistryUtils.java    From big-c with Apache License 2.0 3 votes vote down vote up
/**
 * Create a path for listing components under a service
 * @param user username or ""
 * @param serviceClass service name
 * @param serviceName service name unique for that user and service class
 * @return a full path
 */
public static String componentListPath(String user,
    String serviceClass, String serviceName) {

  return join(servicePath(user, serviceClass, serviceName),
      RegistryConstants.SUBPATH_COMPONENTS);
}