LinuxCommandLibrary

cbt

Manage Cloud Bigtable clusters and tables

TLDR

List tables in the current project

$ cbt ls
copy

Print count of rows in a specific table in the current project
$ cbt count "[table_name]"
copy

Display a single row from a specific table with only 1 (most recent) cell revision per column in the current project
$ cbt lookup "[table_name]" "[row_key]" cells-per-column=[1]
copy

Display a single row with only specific column(s) (omit qualifier to return entire family) in the current project
$ cbt lookup "[table_name]" "[row_key]" columns="[family1:qualifier1,family2:qualifier2,...]"
copy

Search up to 5 rows in the current project by a specific regex pattern and print them
$ cbt read "[table_name]" regex="[row_key_pattern]" count=[5]
copy

Read a specific range of rows and print only returned row keys in the current project
$ cbt read [table_name] start=[start_row_key] end=[end_row_key] keys-only=true
copy

SYNOPSIS

cbt command [arguments...]

PARAMETERS

help
    Displays help information for cbt or a specific command.

createinstance
    Creates a new Cloud Bigtable instance.

deleteinstance
    Deletes an existing Cloud Bigtable instance.

listinstances
    Lists available Cloud Bigtable instances.

createtable
    Creates a new table in a Cloud Bigtable instance.

deletetable
    Deletes a table from a Cloud Bigtable instance.

listtables
    Lists tables in a Cloud Bigtable instance.

write
    Writes data to a Cloud Bigtable table.

read
    Reads data from a Cloud Bigtable table.

count
    Counts the number of rows in a table.

delete
    Deletes rows or cells from a table.

lookup
    Looks up a single row in a table.

truncate
    Truncates a table by deleting all rows. Note: data is NOT immediately purged and is still recoverable for a period of time

gcpolicy
    Manages garbage collection policies for column families.

updateinstance
    Updates properties of an existing Bigtable Instance

backup
    Create, delete, restore, and list Bigtable backups.

DESCRIPTION

The cbt command-line tool provides a flexible interface for interacting with Google Cloud Bigtable. It allows users to manage and interact with Bigtable instances, tables, and data.

cbt supports various operations including creating and deleting instances and tables, listing existing resources, writing and reading data, and managing access control. It is designed for both interactive use and scripting, making it suitable for both manual administration and automated tasks. Authentication with Google Cloud is usually handled using service accounts or user credentials configured with `gcloud auth`. Understanding the Bigtable data model is key to effective usage: Bigtable organizes data into rows and columns. Rows are indexed by a row key, and columns are grouped into column families. cbt directly mirrors the API functionalities, ensuring comprehensive control over Bigtable.

CAVEATS

cbt requires proper authentication with Google Cloud, usually achieved through `gcloud auth`. Ensure your service account or user credentials have the necessary permissions to interact with Bigtable resources.
The data format used by cbt needs to be correctly specified to avoid write errors. Deleting data using cbt may not immediately free up storage space; Bigtable performs compaction and garbage collection in the background.

DATA FORMAT

When using commands like write, the data format is crucial. The expected format generally involves specifying the row key, column family, column qualifier, and value. Incorrect formatting will lead to errors. For more complex data types consider encoding them before writing. The recommended encoding type is byte array.

AUTHENTICATION

cbt uses Google Cloud authentication. Usually, this involves setting the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to point to a service account key file, or using `gcloud auth application-default login` to authenticate as a user. Correctly configured credentials are vital for cbt to function properly.

ERROR HANDLING

cbt provides error messages, but they may not always be immediately clear. When encountering issues, review the command syntax, authentication settings, and Cloud Bigtable access permissions. Consulting the Cloud Bigtable documentation is highly advisable for troubleshooting.

HISTORY

cbt was developed by Google to provide a command-line interface to their Cloud Bigtable NoSQL database service. It evolved alongside the Cloud Bigtable service to offer increasingly comprehensive management capabilities. The initial versions focused on basic table management and data manipulation and later expanded to encompass instance management, access control, and backup/restore operations.

SEE ALSO

gcloud(1)

Copied to clipboard