简体   繁体   中英

How to flush data in all tables of keyspace in cassandra?

I am currently writing tests in golang and I want to get rid of all the data of tables after finishing tests. I was wondering if it is possible to flush the data of all tables in cassandra.

FYI: I am using 3.11 version of Cassandra.

The term "flush" is ambiguous in this case.

In Cassandra, "flush" is an operation where data is "flushed" from memory and written to disk as SSTables. Flushing can happen automatically based on certain triggers or can be done manually with the nodetool flush command.

However based on your description, what you want is to "truncate" the contents of tables. You can do this using the following CQL command:

cqlsh> TRUNCATE ks_name.table_name

You will need to iterate over each table in the keyspace. For more info, see the CQL TRUNCATE command . Cheers!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM