Saturday, September 13, 2014

How to Stop compaction for specific keyspace in cassandra

Problem statement
How to stop compaction for a specific keyspace in cassandra?

Reason behind the problem statement
We had 17TB of data in a keyspace and lot of heavy compaction was running/was pending on this keyspace. UAT was running on another keyspace and during the UAT, we wanted the compaction for this keyspace to run smoothly. (The other keyspace was not very important during UAT). So temporarily we wanted to stop compaction on that keyspace to ensure it does not eat up cluster resources.

Solution
Set compaction threshold’s min value high enough to ensure compaction does not get triggered. The min threshold means that compaction will not be triggered until the sstables count reaches this minThreshold value. So if you set the value to let’s say 100,000; compaction will not be triggered until sstables count reach 100,000 – which practically may mean never!
>> nodetool setcompactionthreshold <keyspace> <cfname> <minthreshold> <maxthreshold>
(I am yet to try this)

Update
Apparently setting the min/max threshold value to 0 stops the compaction. Also, this is only possible from JMX and not from CLI!
Another option is to use 'disableautocompaction' using "nodetool disableautocompaction"

Yet to verify this.





No comments:

Post a Comment