سؤال

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