You can start the emulator using up.sh
. This just simply launches the following command...docker run -p 9010:9010 -p 9020:9020 gcr.io/cloud-spanner-emulator/emulator
. To be truly useful the emulator must be configured using gcloud
. I used the following commands to get the emulator properly configured after starting.
- Create a new
config
calledemulator-config
with the following properties:
gcloud config configurations create emulator-config
gcloud config set auth/disable_credentials true
gcloud config set api_endpoint_overrides/spanner http://localhost:9020/
gcloud config set project benchbase-project
- Create a Spanner instance called
benchbase-instance
inside the emulator using the newconfig
calledemulator-config
gcloud spanner instances create benchbase-instance --config=emulator-config --description="Benchbase Emulator Instance" --nodes=1
- Create a new Spanner database called
benchbase
in the newbenchbase-instance
.
gcloud spanner databases create benchbase --instance benchbase-instance
Once you are done you can clean up the resources you've created...
- This will delete the Spanner instance.
gcloud spanner instances delete benchbase-instance
- Activate your default
configuation
.
gcloud config configurations activate default
- Delete your
emulator-config
.
gcloud config configurations delete emulator-config
- Bring down the Emulator docker image.