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.
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
gcloudcommand-line tool installation to get the latest features:gcloud components update betaRun the following command to start the emulator:
gcloud beta emulators bigtable startIf 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 startThe 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-portflag, replacing [HOST] and [PORT]:gcloud beta emulators bigtable start --host-port=[HOST]:[PORT]In the environment for your application, set the
BIGTABLE_EMULATOR_HOSTenvironment 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_HOSTwith 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_transformerblock_allcells_per_column_limitcells_per_row_limit_filtercells_per_row_offset_filterchaincolumn_rangeconditioninterleavepass_allrow_samplestrip_value_transformertimestamp_rangevalue_range_filter |
column_qualifier_regexfamily_name_regexrow_key_regexvalue_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.