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


Java RemoteAdmin.isTableAvailable方法代码示例

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


在下文中一共展示了RemoteAdmin.isTableAvailable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例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.getTableName().getName())) {
    admin.createTable(tableDescriptor);
    return true;
  }
  return false;
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:10,代码来源:PerformanceEvaluation.java


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