12

What is the command to update a column family and alter its gc_grace_seconds value using cassandra-cli?

Adrian Frühwirth
  • 42,970
  • 10
  • 60
  • 71
juan
  • 80,295
  • 52
  • 162
  • 195

3 Answers3

35

For CQLSH

alter table <table_name> with GC_GRACE_SECONDS = <timeout>;

e.g:

alter table yawn with GC_GRACE_SECONDS = 3600;

where yawn is our table name and 3600 is an hour;

Ravindranath Akila
  • 209
  • 3
  • 35
  • 45
11

On cassandra-cli is without "seconds"

UPDATE COLUMN FAMILY cf with GC_GRACE = 86400; //one day
Adrian Frühwirth
  • 42,970
  • 10
  • 60
  • 71
  • i updated my columnfamily as above to delete the rowkey, but rowkey remains same –  Jan 15 '14 at 06:54
1
use ks;
update column family cf with gc_grace_seconds = 864000;
Richard
  • 11,050
  • 2
  • 46
  • 33
  • it giving this java.lang.IllegalArgumentException: No enum constant org.apache.cassandra.cli.CliClient.ColumnFamilyArgument.GC_GRACE_SECONDS –  Jan 15 '14 at 06:57
  • See the accepted answer, it's meant to be gc_grace not gc_grace_seconds. – Richard Jan 15 '14 at 15:40