Pergunta

I use cassandra in my project, and it is not distributed, now I write some junit test, and I want clear my database after finished every test, but the rowkey can not be deleted? can you tell me how to delete cassandra rowkey.

Foi útil?

Solução 2

To clear all data from a column family you should use truncate. You can do this from cassandra-cli:

[default@unknown] use ks;
Authenticated to keyspace: ks
[default@ks] truncate cf;

Outras dicas

With Hector to you do:

Mutator<K> = HFactory.createMutator(keyspace, Serializer<K>);
mutator.addDeletion(key, columnFamilyName);
mutator.execute();

where K is the TYPE of your row

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top