简体   繁体   English

如何flush cassandra中keyspace所有表的数据?

[英]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.我目前正在 golang 中编写测试,我想在完成测试后摆脱表的所有数据。 I was wondering if it is possible to flush the data of all tables in cassandra.想知道能不能把cassandra里面所有表的数据都flush掉。

FYI: I am using 3.11 version of Cassandra.仅供参考:我使用的是 Cassandra 的 3.11 版本。

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.在 Cassandra 中,“刷新”是将数据从 memory 中“刷新”并作为 SSTables 写入磁盘的操作。 Flushing can happen automatically based on certain triggers or can be done manually with the nodetool flush command.刷新可以根据某些触发器自动发生,也可以使用nodetool flush命令手动完成。

However based on your description, what you want is to "truncate" the contents of tables.但是根据您的描述,您想要的是“截断”表的内容。 You can do this using the following CQL command:您可以使用以下 CQL 命令执行此操作:

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 .有关详细信息,请参阅CQL TRUNCATE命令 Cheers!干杯!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从 Cassandra 密钥空间中删除所有表和 UDT? - How to drop all Tables and UDTs from a Cassandra Keyspace? 密钥空间和表格不能在cassandra中跨数据中心进行复制 - keyspace and tables not replicating across data centre in cassandra 如何使用 Spring Boot 初始化 Cassandra 键空间和表 - How to initialize Cassandra keyspace and tables with Spring boot Cassandra:如何将整个表移动到另一个键空间 - Cassandra: how to move whole tables to another keyspace 如何在 Cassandra 中获取键空间中的表数? - How to obtain number of tables in a keyspace in Cassandra? 如何将Cassandra从一个密钥空间数据迁移到另一个密钥空间? - How to do data migration of Cassandra from one keyspace to another keyspace? 如何删除Cassandra Keyspace中的所有行 - How to delete all rows in Cassandra Keyspace Cassandra:根据限制(例如LIKE或CONTAINS)列出键空间中的所有表吗? - Cassandra: List all tables in keyspace based on restriction such as LIKE or CONTAINS? outworkers phantom disable table create for some but not all tables in a cassandra keyspace - outworkers phantom disable table create for some but not all tables in a cassandra keyspace 从cassandra的键空间中检索节俭和CQL的所有columnfamily /表 - Retrieve all the columnfamily / tables of thrift and CQL from the keyspace in cassandra
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM