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


Java RemoteAdmin类代码示例

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


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

示例1: createTable

import org.apache.hadoop.hbase.rest.client.RemoteAdmin; //导入依赖的package包/类
/**
 * Helper method to create an HBase table in an Amazon EMR cluster with HBase installed
 * 
 * @param tableName - name for table to create
 * @param dnsId - Amazon EMR master node public DNS
 * @param hbaseRestPort - HBase Rest port
 */
public static void createTable(String tableName, String dnsId, int hbaseRestPort) {
	Configuration config = HBaseConfiguration.create();
	RemoteAdmin admin = new RemoteAdmin(new Client(new Cluster().add(dnsId, hbaseRestPort)), config);
	String [] families = {"user", "address", "contact", "likes"};
	try {
		if (admin.isTableAvailable(tableName)) {
			LOG.info("table already exists!");
			return;
		} else {
			HTableDescriptor tableDesc = new HTableDescriptor(tableName);
			for (int i = 0; i < families.length; i++) {
				tableDesc.addFamily(new HColumnDescriptor(families[i]));
			}
			admin.createTable(tableDesc);
			isTableAvailable = true;
			LOG.info("create table " + tableName + " ok.");
		} 

	} catch (IOException e) {
		LOG.error(e, e.getCause()); 
	}

}
 
开发者ID:awslabs,项目名称:aws-big-data-blog,代码行数:31,代码来源:HBaseUtils.java

示例2: tablesExists

import org.apache.hadoop.hbase.rest.client.RemoteAdmin; //导入依赖的package包/类
/**
 * Helper method that checks if a table exists in HBase
 * 
 * @param tableName - table to check
 * @param dnsId - Amazon EMR master node public DNS
 * @param hbaseRestPort - HBase Rest port
 * @return
 */
public static boolean tablesExists(String tableName, String dnsId, int hbaseRestPort) {
	Configuration config = HBaseConfiguration.create();
	RemoteAdmin admin = new RemoteAdmin(new Client(new Cluster().add(dnsId, hbaseRestPort)), config);
	try {
		if (admin.isTableAvailable(tableName)) {
			LOG.info("table already exists!");
			System.out.println("table already exists!");
			return true;
		}
		
	} catch (IOException e) {
		e.printStackTrace();
		LOG.error(e, e.getCause()); 
	}
	return false;
}
 
开发者ID:awslabs,项目名称:aws-big-data-blog,代码行数:25,代码来源:HBaseUtils.java

示例3: runNIsMoreThanOne

import org.apache.hadoop.hbase.rest.client.RemoteAdmin; //导入依赖的package包/类
private void runNIsMoreThanOne(final Class<? extends Test> cmd)
throws IOException, InterruptedException, ClassNotFoundException {
  RemoteAdmin remoteAdmin = new RemoteAdmin(new Client(cluster), getConf());
  checkTable(remoteAdmin);
  if (nomapred) {
    doMultipleClients(cmd);
  } else {
    doMapReduce(cmd);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:11,代码来源:PerformanceEvaluation.java

示例4: checkTable

import org.apache.hadoop.hbase.rest.client.RemoteAdmin; //导入依赖的package包/类
private boolean checkTable() throws IOException {
  HTableDescriptor tableDescriptor = getTableDescriptor();
  RemoteAdmin admin = new RemoteAdmin(new Client(cluster), conf);
  if (!admin.isTableAvailable(tableDescriptor.getName())) {
    admin.createTable(tableDescriptor);
    return true;
  }
  return false;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:10,代码来源:PerformanceEvaluation.java

示例5: main

import org.apache.hadoop.hbase.rest.client.RemoteAdmin; //导入依赖的package包/类
public static void main(String[] args) throws Exception
{
  Cluster cluster = new Cluster();
  for (String arg : args)
    cluster.add(arg, 8088);

  Client client = new Client(cluster);
  RemoteAdmin remoteAdmin = new RemoteAdmin(client, new Configuration());
  VersionModel restVersion = remoteAdmin.getRestVersion();
  System.out.println(restVersion.toString());
}
 
开发者ID:jan-zajic,项目名称:mesos-hbase,代码行数:12,代码来源:TestConnectToHbaseRest.java

示例6: checkTable

import org.apache.hadoop.hbase.rest.client.RemoteAdmin; //导入依赖的package包/类
private boolean checkTable() throws IOException {
  HTableDescriptor tableDescriptor = getTableDescriptor();
  RemoteAdmin admin = new RemoteAdmin(new Client(cluster), conf);
  if (!admin.isTableAvailable(tableDescriptor.getTableName().getName())) {
    admin.createTable(tableDescriptor);
    return true;
  }
  return false;
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:10,代码来源:PerformanceEvaluation.java


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