Atul Takekar
Atul Takekar

Reputation: 49

setting ttl of google bigtable using gcloud

I was using aws dynamo db and used ttl property to delete record after some time but now i am moving to GCP,

In big table I can set expiration time for value hence I used Bigtable instead of Google Datastore

I know I can set that using Go CLI using command

cbt setgcpolicy my-table cf1 maxage=1d

But I want to set it using gcloud cli or while creating using console or deployment manager

Thanks in advance

Upvotes: 1

Views: 1043

Answers (2)

Gary Elliott
Gary Elliott

Reputation: 994

You can't do this through gcloud or the Google Cloud Console. However, you can use the cbt tool, which is a component of the Cloud SDK (gcloud).

Also, this Deployment Manager example should help with setting GC rules:

tables:
  data:
    granularity: MILLIS
    columnFamilies:
      foo:
        gcRule:
          maxNumVersions: 2
      bar:
        gcRule:
          maxNumVersions: 2

Upvotes: 2

Xiaoxia Lin
Xiaoxia Lin

Reputation: 746

The cbt tool is available as a Cloud SDK component. You can check if it is already installed by running following command:

gcloud components list

If it is not installed, you can run:

gcloud components update
gcloud components install cbt

After that, you should be able to run the same cbt command in your cloud shell.

Upvotes: 0

Related Questions