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


Java HBaseAdmin.modifyColumn方法代碼示例

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


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

示例1: loadTest

import org.apache.hadoop.hbase.client.HBaseAdmin; //導入方法依賴的package包/類
@Test(timeout=TIMEOUT_MS)
public void loadTest() throws Exception {
  HBaseAdmin admin = new HBaseAdmin(conf);

  compression = Compression.Algorithm.GZ; // used for table setup
  super.loadTest();

  HColumnDescriptor hcd = getColumnDesc(admin);
  System.err.println("\nDisabling encode-on-disk. Old column descriptor: " + hcd + "\n");
  HTable t = new HTable(this.conf, TABLE);
  assertAllOnLine(t);

  admin.disableTable(TABLE);
  admin.modifyColumn(TABLE, hcd);

  System.err.println("\nRe-enabling table\n");
  admin.enableTable(TABLE);

  System.err.println("\nNew column descriptor: " +
      getColumnDesc(admin) + "\n");

  // The table may not have all regions on line yet.  Assert online before
  // moving to major compact.
  assertAllOnLine(t);

  System.err.println("\nCompacting the table\n");
  admin.majorCompact(TABLE.getName());
  // Wait until compaction completes
  Threads.sleepWithoutInterrupt(5000);
  HRegionServer rs = TEST_UTIL.getMiniHBaseCluster().getRegionServer(0);
  while (rs.compactSplitThread.getCompactionQueueSize() > 0) {
    Threads.sleep(50);
  }

  System.err.println("\nDone with the test, shutting down the cluster\n");
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:37,代碼來源:TestLoadAndSwitchEncodeOnDisk.java

示例2: enableOmidCompaction

import org.apache.hadoop.hbase.client.HBaseAdmin; //導入方法依賴的package包/類
public static void enableOmidCompaction(Configuration conf,
                                        TableName table, byte[] columnFamily) throws IOException {
    HBaseAdmin admin = new HBaseAdmin(conf);
    try {
        HTableDescriptor desc = admin.getTableDescriptor(table);
        HColumnDescriptor cfDesc = desc.getFamily(columnFamily);
        cfDesc.setValue(OmidCompactor.OMID_COMPACTABLE_CF_FLAG,
                Boolean.TRUE.toString());
        admin.modifyColumn(table, cfDesc);
    } finally {
        admin.close();
    }
}
 
開發者ID:apache,項目名稱:incubator-omid,代碼行數:14,代碼來源:CompactorUtil.java

示例3: disableOmidCompaction

import org.apache.hadoop.hbase.client.HBaseAdmin; //導入方法依賴的package包/類
public static void disableOmidCompaction(Configuration conf,
                                         TableName table, byte[] columnFamily) throws IOException {
    HBaseAdmin admin = new HBaseAdmin(conf);
    try {
        HTableDescriptor desc = admin.getTableDescriptor(table);
        HColumnDescriptor cfDesc = desc.getFamily(columnFamily);
        cfDesc.setValue(OmidCompactor.OMID_COMPACTABLE_CF_FLAG,
                Boolean.FALSE.toString());
        admin.modifyColumn(table, cfDesc);
    } finally {
        admin.close();
    }
}
 
開發者ID:apache,項目名稱:incubator-omid,代碼行數:14,代碼來源:CompactorUtil.java

示例4: applyColumnFamilyOptions

import org.apache.hadoop.hbase.client.HBaseAdmin; //導入方法依賴的package包/類
/**
 * Apply column family options such as Bloom filters, compression, and data
 * block encoding.
 */
protected void applyColumnFamilyOptions(byte[] tableName,
    byte[][] columnFamilies) throws IOException {
  HBaseAdmin admin = new HBaseAdmin(conf);
  HTableDescriptor tableDesc = admin.getTableDescriptor(tableName);
  LOG.info("Disabling table " + Bytes.toString(tableName));
  admin.disableTable(tableName);
  for (byte[] cf : columnFamilies) {
    HColumnDescriptor columnDesc = tableDesc.getFamily(cf);
    boolean isNewCf = columnDesc == null;
    if (isNewCf) {
      columnDesc = new HColumnDescriptor(cf);
    }
    if (bloomType != null) {
      columnDesc.setBloomFilterType(bloomType);
    }
    if (compressAlgo != null) {
      columnDesc.setCompressionType(compressAlgo);
    }
    if (dataBlockEncodingAlgo != null) {
      columnDesc.setDataBlockEncoding(dataBlockEncodingAlgo);
      columnDesc.setEncodeOnDisk(!encodeInCacheOnly);
    }
    if (inMemoryCF) {
      columnDesc.setInMemory(inMemoryCF);
    }
    if (isNewCf) {
      admin.addColumn(tableName, columnDesc);
    } else {
      admin.modifyColumn(tableName, columnDesc);
    }
  }
  LOG.info("Enabling table " + Bytes.toString(tableName));
  admin.enableTable(tableName);
}
 
開發者ID:fengchen8086,項目名稱:LCIndex-HBase-0.94.16,代碼行數:39,代碼來源:LoadTestTool.java

示例5: loadTest

import org.apache.hadoop.hbase.client.HBaseAdmin; //導入方法依賴的package包/類
@Test(timeout=TIMEOUT_MS)
public void loadTest() throws Exception {
  HBaseAdmin admin = new HBaseAdmin(conf);

  compression = Compression.Algorithm.GZ; // used for table setup
  super.loadTest();

  HColumnDescriptor hcd = getColumnDesc(admin);
  System.err.println("\nDisabling encode-on-disk. Old column descriptor: " +
      hcd + "\n");
  admin.disableTable(TABLE);
  hcd.setEncodeOnDisk(false);
  admin.modifyColumn(TABLE, hcd);

  System.err.println("\nRe-enabling table\n");
  admin.enableTable(TABLE);

  System.err.println("\nNew column descriptor: " +
      getColumnDesc(admin) + "\n");

  System.err.println("\nCompacting the table\n");
  admin.majorCompact(TABLE);
  // Wait until compaction completes
  Threads.sleepWithoutInterrupt(5000);
  HRegionServer rs = TEST_UTIL.getMiniHBaseCluster().getRegionServer(0);
  while (rs.compactSplitThread.getCompactionQueueSize() > 0) {
    Threads.sleep(50);
  }

  System.err.println("\nDone with the test, shutting down the cluster\n");
}
 
開發者ID:fengchen8086,項目名稱:LCIndex-HBase-0.94.16,代碼行數:32,代碼來源:TestLoadAndSwitchEncodeOnDisk.java

示例6: setUp

import org.apache.hadoop.hbase.client.HBaseAdmin; //導入方法依賴的package包/類
@Before
@Override
public void setUp() throws Exception {
  // Initialize the cluster. This invokes LoadTestTool -init_only, which
  // will create the test table, appropriately pre-split
  super.setUp();

  // Update the test table schema so HFiles from this point will be written with
  // encryption features enabled.
  final HBaseAdmin admin = util.getHBaseAdmin();
  HTableDescriptor tableDescriptor =
      new HTableDescriptor(admin.getTableDescriptor(Bytes.toBytes(getTablename())));
  for (HColumnDescriptor columnDescriptor: tableDescriptor.getColumnFamilies()) {
    columnDescriptor.setEncryptionType("AES");
    LOG.info("Updating CF schema for " + getTablename() + "." +
      columnDescriptor.getNameAsString());
    admin.disableTable(getTablename());
    admin.modifyColumn(getTablename(), columnDescriptor);
    admin.enableTable(getTablename());
    util.waitFor(30000, 1000, true, new Predicate<IOException>() {
      @Override
      public boolean evaluate() throws IOException {
        return admin.isTableAvailable(getTablename());
      }
    });
  }
}
 
開發者ID:tenggyut,項目名稱:HIndex,代碼行數:28,代碼來源:IntegrationTestIngestWithEncryption.java

示例7: applyColumnFamilyOptions

import org.apache.hadoop.hbase.client.HBaseAdmin; //導入方法依賴的package包/類
/**
 * Apply column family options such as Bloom filters, compression, and data
 * block encoding.
 */
protected void applyColumnFamilyOptions(TableName tableName,
    byte[][] columnFamilies) throws IOException {
  HBaseAdmin admin = new HBaseAdmin(conf);
  HTableDescriptor tableDesc = admin.getTableDescriptor(tableName);
  LOG.info("Disabling table " + tableName);
  admin.disableTable(tableName);
  for (byte[] cf : columnFamilies) {
    HColumnDescriptor columnDesc = tableDesc.getFamily(cf);
    boolean isNewCf = columnDesc == null;
    if (isNewCf) {
      columnDesc = new HColumnDescriptor(cf);
    }
    if (bloomType != null) {
      columnDesc.setBloomFilterType(bloomType);
    }
    if (compressAlgo != null) {
      columnDesc.setCompressionType(compressAlgo);
    }
    if (dataBlockEncodingAlgo != null) {
      columnDesc.setDataBlockEncoding(dataBlockEncodingAlgo);
    }
    if (inMemoryCF) {
      columnDesc.setInMemory(inMemoryCF);
    }
    if (cipher != null) {
      byte[] keyBytes = new byte[cipher.getKeyLength()];
      new SecureRandom().nextBytes(keyBytes);
      columnDesc.setEncryptionType(cipher.getName());
      columnDesc.setEncryptionKey(EncryptionUtil.wrapKey(conf,
        User.getCurrent().getShortName(),
        new SecretKeySpec(keyBytes, cipher.getName())));
    }
    if (isNewCf) {
      admin.addColumn(tableName, columnDesc);
    } else {
      admin.modifyColumn(tableName, columnDesc);
    }
  }
  LOG.info("Enabling table " + tableName);
  admin.enableTable(tableName);
}
 
開發者ID:tenggyut,項目名稱:HIndex,代碼行數:46,代碼來源:LoadTestTool.java


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