开发者

how to create table in google Bigtable

i want to create table in google big table using java 开发者_如何学Pythonand servelt code? how to create table and insert into Google big table database? I want sample coding to create table in Google big table?


Google does not give public access to Bigtable.

Are you talking about the Datastore for App Engine (which runs on Bigtable)? If so, there is lots of documentation over at the App Engine developer site, in particular Getting Started For Java: Using the Datastore with JDO.


Six years later, it is now possible. Take a look at this Quickstart page for how to get a Bigtable instance and start writing to it https://cloud.google.com/bigtable/docs/quickstart

And then here is a sample "Hello, World!" application https://cloud.google.com/bigtable/docs/samples-java-hello

For example

  try (Connection connection = BigtableConfiguration.connect(projectId, instanceId)) {

      Admin admin = connection.getAdmin();

      HTableDescriptor descriptor = new HTableDescriptor(TableName.valueOf(TABLE_NAME));
      descriptor.addFamily(new HColumnDescriptor(COLUMN_FAMILY_NAME));

      print("Create table " + descriptor.getNameAsString());
      admin.createTable(descriptor);

      Table table = connection.getTable(TableName.valueOf(TABLE_NAME));

      print("Write some greetings to the table");
      for (int i = 0; i < GREETINGS.length; i++) {
        String rowKey = "greeting" + i;

        Put put = new Put(Bytes.toBytes(rowKey));
        put.addColumn(COLUMN_FAMILY_NAME, COLUMN_NAME, Bytes.toBytes(GREETINGS[i]));
        table.put(put);
      }

      String rowKey = "greeting0";
      Result getResult = table.get(new Get(Bytes.toBytes(rowKey)));
}


Have a google of Hadoop (http://hadoop.apache.org/) - and the hadoop based Hbase (http://wiki.apache.org/hadoop/Hbase). These are similar-in-concept implementations to google's bigtable. If you cannot readily use these libraries, then you are out of luck.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜