Examples of HBaseHelper


Examples of util.HBaseHelper

public class PutListErrorExample2 {

  public static void main(String[] args) throws IOException {
    Configuration conf = HBaseConfiguration.create();
    HBaseHelper helper = HBaseHelper.getHelper(conf);
    helper.dropTable("testtable");
    helper.createTable("testtable", "colfam1");
    HTable table = new HTable(conf, "testtable");

    List<Put> puts = new ArrayList<Put>();

    // vv PutListErrorExample2
View Full Code Here

Examples of util.HBaseHelper

public class TimestampFilterExample {

  public static void main(String[] args) throws IOException {
    Configuration conf = HBaseConfiguration.create();

    HBaseHelper helper = HBaseHelper.getHelper(conf);
    helper.dropTable("testtable");
    helper.createTable("testtable", "colfam1");
    System.out.println("Adding rows to table...");
    helper.fillTable("testtable", 1, 100, 20, true, "colfam1");

    HTable table = new HTable(conf, "testtable");

    // vv TimestampFilterExample
    List<Long> ts = new ArrayList<Long>();
View Full Code Here

Examples of util.HBaseHelper

    }

    // ^^ MissingRegionExample

  public static void main(String[] args) throws IOException {
    HBaseHelper helper = HBaseHelper.getHelper(conf);
    helper.dropTable("testtable");

    byte[][] regions = new byte[][] {
      Bytes.toBytes("row-030"),
      Bytes.toBytes("row-060")
    };
    helper.createTable("testtable", regions, "colfam1", "colfam2");
    helper.fillTable("testtable", 1, 100, 1, 3, false, "colfam1", "colfam2");
    printTableRegions("testtable");

    HTable table = new HTable(conf, "testtable");

    // vv MissingRegionExample
View Full Code Here

Examples of util.HBaseHelper

public class PutWriteBufferExample {

  public static void main(String[] args) throws IOException {
    Configuration conf = HBaseConfiguration.create();

    HBaseHelper helper = HBaseHelper.getHelper(conf);
    helper.dropTable("testtable");
    helper.createTable("testtable", "colfam1");
    // vv PutWriteBufferExample
    HTable table = new HTable(conf, "testtable");
    System.out.println("Auto flush: " + table.isAutoFlush())// co PutWriteBufferExample-1-CheckFlush Check what the auto flush flag is set to, should print "Auto flush: true".

    table.setAutoFlush(false); // co PutWriteBufferExample-2-SetFlush Set the auto flush to false to enable the client-side write buffer.
View Full Code Here

Examples of util.HBaseHelper

  public static void main(String[] args) throws IOException, InterruptedException {
    // vv CreateTableExample
    Configuration conf = HBaseConfiguration.create();
    // ^^ CreateTableExample
    HBaseHelper helper = HBaseHelper.getHelper(conf);
    helper.dropTable("testtable");
    // vv CreateTableExample

    HBaseAdmin admin = new HBaseAdmin(conf); // co CreateTableExample-1-CreateAdmin Create a administrative API instance.

    HTableDescriptor desc = new HTableDescriptor( // co CreateTableExample-2-CreateHTD Create the table descriptor instance.
View Full Code Here

Examples of util.HBaseHelper

  // vv CreateTableWithRegionsExample
  public static void main(String[] args) throws IOException, InterruptedException {
    Configuration conf = HBaseConfiguration.create();
    // ^^ CreateTableWithRegionsExample

    HBaseHelper helper = HBaseHelper.getHelper(conf);
    helper.dropTable("testtable1");
    helper.dropTable("testtable2");

    // vv CreateTableWithRegionsExample
    HBaseAdmin admin = new HBaseAdmin(conf);

    HTableDescriptor desc = new HTableDescriptor(
View Full Code Here

Examples of util.HBaseHelper

public class ModifyTableExample {

  public static void main(String[] args) throws IOException, InterruptedException {
    Configuration conf = HBaseConfiguration.create();

    HBaseHelper helper = HBaseHelper.getHelper(conf);
    helper.dropTable("testtable");
    // vv ModifyTableExample
    byte[] name = Bytes.toBytes("testtable");
    HBaseAdmin admin = new HBaseAdmin(conf);
    HTableDescriptor desc = new HTableDescriptor(name);
    HColumnDescriptor coldef1 = new HColumnDescriptor(
View Full Code Here

Examples of util.HBaseHelper

public class TableOperationsExample {

  public static void main(String[] args) throws IOException, InterruptedException {
    Configuration conf = HBaseConfiguration.create();

    HBaseHelper helper = HBaseHelper.getHelper(conf);
    helper.dropTable("testtable");

    // vv TableOperationsExample
    HBaseAdmin admin = new HBaseAdmin(conf);

    HTableDescriptor desc = new HTableDescriptor(
View Full Code Here

Examples of util.HBaseHelper

public class ListTablesExample {

  public static void main(String[] args) throws IOException, InterruptedException {
    Configuration conf = HBaseConfiguration.create();

    HBaseHelper helper = HBaseHelper.getHelper(conf);
    helper.dropTable("testtable1");
    helper.dropTable("testtable2");
    helper.dropTable("testtable3");
    helper.createTable("testtable1", "colfam1", "colfam2", "colfam3");
    helper.createTable("testtable2", "colfam1", "colfam2", "colfam3");
    helper.createTable("testtable3", "colfam1", "colfam2", "colfam3");

    // vv ListTablesExample
    HBaseAdmin admin = new HBaseAdmin(conf);

    HTableDescriptor[] htds = admin.listTables();
View Full Code Here

Examples of util.HBaseHelper

public class IncrementSingleExample {

  public static void main(String[] args) throws IOException {
    Configuration conf = HBaseConfiguration.create();

    HBaseHelper helper = HBaseHelper.getHelper(conf);
    helper.dropTable("counters");
    helper.createTable("counters", "daily");
    // vv IncrementSingleExample
    HTable table = new HTable(conf, "counters");

    long cnt1 = table.incrementColumnValue(Bytes.toBytes("20110101"), // co IncrementSingleExample-1-Incr1 Increase counter by one.
      Bytes.toBytes("daily"), Bytes.toBytes("hits"), 1);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.