How to disable compaction in cassandra and kick start again at end?

I am inserting records in billions into cassandra simultaneously. So, to utilize resource I need to disable the compaction at the time the insertion is in progress. Once the insertion is done I should be able to manually kick start the Compaction. I am using hector-core-1.0-5 as API to connect to cassandra. Can any one help me in how to do this.

Upvotes: 2

Views: 1466

Answers (2)

libjack
libjack

Reputation: 6443

You can control the compaction for a column family via the management console (JMX). You can disable before loading and then force major compaction after data loaded.

Upvotes: 3

libjack
libjack

Reputation: 6443

The method I used was to use the cassandra-cli to update the column family compression options.

to turn on

use myks;
update column family mycf with compression_options={sstable_compression:SnappyCompressor, chunk_length_kb:64};

and then off:

use myks;
update column family mycf with compression_options=null;

You will have to force a rebuild of sstables after this update using nodetool (scrub) if you want the update immediately, else might happen when unexpected.

I only did this in testing, to compare sizes of compressed vs non-compressed column families. But I found it better to enable compression and then do the bulk loads, otherwise the sstable rebuild took forever.

Upvotes: -1

Related Questions