Basics of Google Cloud Bigtable

30 minutes
  • 3 Learning Objectives

About this Hands-on Lab

You are tasked with exploring Cloud Bigtable as a potential database for storing location data updates for a fleet of public transport vehicles. For now, you need to interact with Bigtable to help you develop a row-key design. In this lab, we will create a Cloud Bigtable instance and then write and query data with the HBase shell.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create a Cloud Bigtable Instance

For our Cloud Bigtable instance:

  1. Create a Bigtable instance with the name vehicle-locations.
  2. Make sure HDD is selected for our instance.
  3. For Region, choose us-east1 and set the Zone as Any.
  4. Make sure the number of nodes listed is 1.
Connect to Bigtable with HBase

To connect to Bigtable with HBase:

  1. From the top of the GCP dashboard, click the Activate Cloud Shell button (the square button with >_ in it).
  2. Using sudo, update the cloud shell and install the Java 8 runtime for HBase.
  3. Clone the Bigtable examples repo:
  4. Change to the cloud-bigtable-examples/quickstart directory.
  5. Run the script to set up a connection. Don’t worry about any errors or warnings, as the script should pick up your project’s Bigtable instance and drop you into a connected HBase shell.

Don’t disconnect! Stay in the HBase shell for the next objective.

Create a Table and Write and Query Its Data with HBase

We need to create a table using the provided information and then query that data with HBase:

  1. Create a table named vehicles with column groups called loc and det.
  2. Enter the following details into the table for our two vehicles, placing the Lat and Long data in the loc column group, and the Company and Route data in the det column group:
Row Key            Lat                        Long                Company    Route  
  1. Use get to pull a single row using a row key.
  2. Scan the entire table.
  3. Find all vehicles assigned to Route 88 using a ValueFilter with a regexstring.
    Note: This is an example of an extremely inefficient way to search the database. The entire table needs to be read to find matching rows.
  4. Perform a scan for the second vehicle using the ROWPREFIXFILTER filter and the first 6 characters from the Row Key column.

Additional Resources

Log in to Google Cloud Platform by opening in a private browser window. Then, sign in using the credentials provided on the lab page.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?