Quickstart Using HBase Shell

This page explains how to use the HBase shell to connect to a Cloud Bigtable instance; perform basic administrative tasks; and read and write data in a table.

If you do not wish to use the HBase shell, you can follow the quickstart using the cbt command instead.

Before you begin

  1. Sign in to your Google account.

    If you don't already have one, sign up for a new account.

  2. Select or create a Cloud Platform project.

    Go to the Manage resources page

  3. Enable billing for your project.

    Enable billing

  4. Enable the Cloud Bigtable and Cloud Bigtable Admin APIs.

    Enable the APIs

Create an instance

  1. Go to the Create Instance page in the Google Cloud Platform Console.

    Go to the Create Instance page

    Screenshot of the
    'Create instance' page

  2. For Instance name, enter Quickstart instance.
  3. For Instance ID, enter quickstart-instance.
  4. For Instance type, select Development.
  5. For Cluster ID, enter quickstart-instance-cluster.
  6. For Zone, select us-east1-b.
  7. Click Create to create the instance.

Connect to your instance

  1. In the Google Cloud Platform Console, click the Cloud Shell icon (Cloud Shell icon) in the upper right corner.
  2. When Cloud Shell is ready to use, download and unzip the quickstart files:
    curl -f -O https://storage.googleapis.com/cloud-bigtable/quickstart/GoogleCloudBigtable-Quickstart-1.0.0-pre3.zip
    unzip GoogleCloudBigtable-Quickstart-1.0.0-pre3.zip
  3. Change to the quickstart directory, then start the HBase shell:


Now you're connected!

Read and write data

  1. Create a table named my-table, with one column family named cf1:

    create 'my-table', 'cf1'

    The shell displays output similar to the following:

    0 row(s) in 1.5210 seconds
    => Hbase::Table - my-table
  2. List your tables:


    The shell displays output similar to the following:

    1 row(s) in 1.3580 seconds
    => ["my-table"]
  3. Put the value test-value in the row r1, using the column family cf1 and the column qualifier c1:

    put 'my-table', 'r1', 'cf1:c1', 'test-value'
  4. Use the scan command to scan the table and read the data you added:

    scan 'my-table'

    The shell displays output similar to the following:

     r1      column=cf1:c1, timestamp=1430687836046, value=test-value
    1 row(s) in 0.6260 seconds
  5. Delete the table my-table:

    disable 'my-table'
    drop 'my-table'
  6. Type exit and press Enter to exit the HBase shell. You will see a series of log messages after you exit, which is normal.

Clean up

To avoid incurring charges to your Google Cloud Platform account for the resources used in this quickstart:

  1. Go to the Instances page in the Google Cloud Platform Console.

    Go to the Instances page

  2. Click Quickstart instance.
  3. Click Delete.

    Screenshot of the
    'Delete instance' pane

  4. Type quickstart-instance, then click Delete to delete the instance.

What's next

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

Cloud Bigtable Documentation