문제

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.

도움이 되었습니까?

해결책 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;

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top