What is the command to update a column family and alter its gc_grace_seconds
value using cassandra-cli
?
Asked
Active
Viewed 1.9k times
12

Adrian Frühwirth
- 42,970
- 10
- 60
- 71

juan
- 80,295
- 52
- 162
- 195
3 Answers
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
-
1CLI approach doesn't work, we get an error message to use CQLSH now, hence this answer. Cassandra 2.0. HTH – Ravindranath Akila Feb 26 '14 at 02:57
-
Please check the value of max_hint_window_in_ms if the hinted_handoff is enabled – S.Bao Aug 13 '20 at 11:52
-
1This is the correct solution even on Cassandra 3.11. – lapo Oct 05 '21 at 06:49
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

Christian Agrazar
- 199
- 1
- 9
-
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