The Cloud SDK provides a local, in-memory emulator for Cloud Bigtable, which you can use to test your application. Because the emulator stores data only in memory, it will not persist data across runs. It is intended to help you use Bigtable for local development and testing, not for production deployments.
You can use the emulator with all Bigtable client libraries except for the PHP client library.
The emulator does not provide administrative APIs to create or manage instances and clusters. After the emulator starts up, you can connect to it using any project and instance name to create tables and read or write data.
Installing the emulator
To install the Bigtable emulator:
Update your
gcloud
command-line tool installation to get the latest features:gcloud components update beta
Run the following command to start the emulator:
gcloud beta emulators bigtable start
If the emulator is not installed already, you will be prompted to download and install the binary for the emulator.
Type Control-C to stop the emulator.
Using the emulator
To use the Bigtable emulator:
Run the following command to start the Bigtable emulator:
gcloud beta emulators bigtable start
The emulator prints the host and port number where it is running.
By default, the emulator chooses
localhost:8086
. To bind the emulator to a specific host and port, use the optional--host-port
flag, replacing [HOST] and [PORT]:gcloud beta emulators bigtable start --host-port=[HOST]:[PORT]
In the environment for your application, set the
BIGTABLE_EMULATOR_HOST
environment variable to the host and port where the Bigtable emulator is running (for example,myhost.example.com:8010
).If you are running the emulator on the same machine as your application, you can use the following command to set this environment variable automatically:
$(gcloud beta emulators bigtable env-init)
Setting this environment variable causes the application to run in the emulator, with no further action required. The client automatically uses the variable if it is set, instead of connecting to the Bigtable service.
When you are finished using the emulator, type Control-C to stop the emulator, then unset
BIGTABLE_EMULATOR_HOST
with the following command:unset BIGTABLE_EMULATOR_HOST
Filters
The following table shows the filters that are currently supported.
Supported | Supported, with limitations | Not supported |
---|---|---|
apply_label_transformer block_all cells_per_column_limit cells_per_row_limit_filter cells_per_row_offset_filter chain column_range condition interleave pass_all row_sample strip_value_transformer timestamp_range value_range_filter |
column_qualifier_regex family_name_regex row_key_regex value_regex |
sink |
Issues related to the Bigtable emulator are tracked in the google-cloud-go GitHub repository, where you can file bug reports and feature requests or comment on existing issues.