use of org.apache.hadoop.hbase.client.HBaseAdmin in project SpyGlass by ParallelAI.
the class HBaseTap method getHBaseAdmin.
protected HBaseAdmin getHBaseAdmin(JobConf conf) throws IOException {
if (hBaseAdmin == null) {
Configuration hbaseConf = HBaseConfiguration.create(conf);
hBaseAdmin = new HBaseAdmin(hbaseConf);
}
return hBaseAdmin;
}
use of org.apache.hadoop.hbase.client.HBaseAdmin in project Solbase by Photobucket.
the class SolbaseUtil method createTermVectorTable.
public static void createTermVectorTable(byte[][] splits) throws IOException {
HTableDescriptor desc = new HTableDescriptor(SolbaseUtil.getTermVectorTableName());
HColumnDescriptor column = new HColumnDescriptor(SolbaseUtil.termVectorDocColumnFamilyName);
SolbaseUtil.setupHColumnDescriptor(column);
desc.addFamily(column);
HBaseAdmin admin;
admin = new HBaseAdmin(SolbaseUtil.conf);
admin.createTable(desc, splits);
}
use of org.apache.hadoop.hbase.client.HBaseAdmin in project Solbase by Photobucket.
the class SolbaseUtil method createDocTable.
public static void createDocTable(byte[][] splits) throws IOException {
HTableDescriptor desc = new HTableDescriptor(SolbaseUtil.getDocTableName());
HColumnDescriptor fieldColumn = new HColumnDescriptor(SolbaseUtil.fieldColumnFamilyName);
SolbaseUtil.setupHColumnDescriptor(fieldColumn);
desc.addFamily(fieldColumn);
HColumnDescriptor allTermsColumn = new HColumnDescriptor(SolbaseUtil.allTermsColumnFamilyName);
SolbaseUtil.setupHColumnDescriptor(allTermsColumn);
desc.addFamily(allTermsColumn);
HColumnDescriptor timestampColumn = new HColumnDescriptor(SolbaseUtil.timestampColumnFamilyName);
SolbaseUtil.setupHColumnDescriptor(timestampColumn);
desc.addFamily(timestampColumn);
HBaseAdmin admin;
admin = new HBaseAdmin(SolbaseUtil.conf);
admin.createTable(desc, splits);
}
use of org.apache.hadoop.hbase.client.HBaseAdmin in project DataX by alibaba.
the class Hbase094xHelper method getTable.
/**
* 每次都获取一个新的HTable 注意:HTable 本身是线程不安全的
*/
public static HTable getTable(com.alibaba.datax.common.util.Configuration configuration) {
String hbaseConnConf = configuration.getString(Key.HBASE_CONFIG);
String tableName = configuration.getString(Key.TABLE);
HBaseAdmin admin = null;
try {
org.apache.hadoop.conf.Configuration hbaseConf = Hbase094xHelper.getHbaseConf(hbaseConnConf);
HTable htable = new HTable(hbaseConf, tableName);
admin = new HBaseAdmin(hbaseConf);
checkHbaseTable(admin, htable);
return htable;
} catch (Exception e) {
throw DataXException.asDataXException(Hbase094xReaderErrorCode.GET_HBASE_TABLE_ERROR, e);
} finally {
Hbase094xHelper.closeAdmin(admin);
}
}
use of org.apache.hadoop.hbase.client.HBaseAdmin in project DataX by alibaba.
the class HbaseUtil method initHtable.
/**
* 每次都获取一个新的HTable 注意:HTable 本身是线程不安全的
*/
public static HTable initHtable(com.alibaba.datax.common.util.Configuration configuration) {
String hbaseConnConf = configuration.getString(Key.HBASE_CONFIG);
String tableName = configuration.getString(Key.TABLE);
HBaseAdmin admin = null;
try {
org.apache.hadoop.conf.Configuration conf = HbaseUtil.getHbaseConf(hbaseConnConf);
conf.set("hbase.meta.scanner.caching", META_SCANNER_CACHING);
HTable htable = HTableManager.createHTable(conf, tableName);
admin = HTableManager.createHBaseAdmin(conf);
check(admin, htable);
return htable;
} catch (Exception e) {
throw DataXException.asDataXException(HbaseReaderErrorCode.INIT_TABLE_ERROR, e);
} finally {
if (admin != null) {
try {
admin.close();
} catch (IOException e) {
// ignore it
}
}
}
}
Aggregations