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


Java HConnection.getTable方法代碼示例

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


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

示例1: initializeAdapter

import org.apache.hadoop.hbase.client.HConnection; //導入方法依賴的package包/類
@Override
public boolean initializeAdapter(Map<String, Object> config) {

	// Initialize HBase Table
	Configuration conf = null;
	conf = HBaseConfiguration.create();
	conf.set("hbase.zookeeper.quorum", _quorum);
	conf.set("hbase.zookeeper.property.clientPort", _port);

	try {
		LOGGER.debug("=======Connecting to HBASE===========");
		LOGGER.debug("=======ZOOKEEPER = {}", conf.get("hbase.zookeeper.quorum"));
		HConnection connection = HConnectionManager.createConnection(conf);
		table = connection.getTable(_tableName);
		return true;
	} catch (IOException e) {
		LOGGER.debug("=======Unable to Connect to HBASE===========");
		e.printStackTrace();
	}

	return false;
}
 
開發者ID:apache,項目名稱:metron,代碼行數:23,代碼來源:CIFHbaseAdapter.java

示例2: populateUserProfile

import org.apache.hadoop.hbase.client.HConnection; //導入方法依賴的package包/類
public static void populateUserProfile(HConnection connection, UserProfile userProfile) throws Exception {
  HTableInterface table = connection.getTable(HBaseTableMetaModel.profileCacheTableName);

  try {
    Put put = new Put(convertKeyToRowKey(HBaseTableMetaModel.profileCacheTableName, userProfile.userId));
    put.add(HBaseTableMetaModel.profileCacheColumnFamily, HBaseTableMetaModel.profileCacheJsonColumn, Bytes.toBytes(userProfile.getJSONObject().toString()));
    put.add(HBaseTableMetaModel.profileCacheColumnFamily, HBaseTableMetaModel.profileCacheTsColumn, Bytes.toBytes(System.currentTimeMillis()));
    table.put(put);
  } finally {
    table.close();
  }
}
 
開發者ID:amitchmca,項目名稱:hadooparchitecturebook,代碼行數:13,代碼來源:HBaseUtils.java

示例3: populateValidationRules

import org.apache.hadoop.hbase.client.HConnection; //導入方法依賴的package包/類
public static void populateValidationRules(HConnection connection, ValidationRules rules) throws Exception {
  HTableInterface table = connection.getTable(HBaseTableMetaModel.profileCacheTableName);

  try {
    Put put = new Put(HBaseTableMetaModel.validationRulesRowKey);
    put.add(HBaseTableMetaModel.profileCacheColumnFamily, HBaseTableMetaModel.validationRulesRowKey, Bytes.toBytes(rules.getJSONObject().toString()));
    table.put(put);
  } finally {
    table.close();
  }
}
 
開發者ID:amitchmca,項目名稱:hadooparchitecturebook,代碼行數:12,代碼來源:HBaseUtils.java

示例4: connectToHashTables

import org.apache.hadoop.hbase.client.HConnection; //導入方法依賴的package包/類
public static HTableInterface[] connectToHashTables(HConnection conn, int num, String prefix) 
		throws IOException {
	HTableInterface[] hashTables = new HTable[num];
	for (int i = 0; i < num; ++i) {
		hashTables[i] = conn.getTable(prefix + String.valueOf(i));
	}
	return hashTables;
}
 
開發者ID:DaniUPC,項目名稱:near-image-replica-detection,代碼行數:9,代碼來源:HBaseUtils.java


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