Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Labs

Basics of Google Cloud Bigtable

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.

Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 30m
Published
Clock icon Apr 09, 2021

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    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.
  2. Challenge

    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: https://github.com/GoogleCloudPlatform/cloud-bigtable-examples.git
    4. Change to the cloud-bigtable-examples/quickstart directory.
    5. Run the quickstart.sh 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.

  3. Challenge

    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  | |---------------- |:----------------: |:-----------------: |:---------: |:-------:| | M117-223 | 40.781212 | -73.961942 | NYMT | 86 | | M117-391 | 40.780664 | -73.958357 | NYMT | 88 |

    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.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

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.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans