Is it possible to dynamically change the compaction strategy of cassandra?

I am completely new to using Cassandra and am asking the basic question I was looking for an answer to. I am using the default compacting strategy which is sized equal to size. I know this can be changed to a Leveled Compaction strategy by running the following command:

ALTER TABLE users WITH
compaction = { 'class' :  'LeveledCompactionStrategy'  }

      

However, I'm not sure if this change will take effect at runtime in a specific keyspace or if I need to restart node for the changes to take effect. I read in the Datastax documentation ( http://www.datastax.com/documentation/cassandra/1.2/cassandra/configuration/configCassandra_yaml_r.html ) which changes to global configurations in the cassandra.yaml file only takes effect after node was restarted and would like to know if this applies to properties related to the key space, such as the compacting strategy.

Thanks in advance for your help.

+3


source to share


2 answers


Newer compaction setup documentation indicates that the correct procedure for enabling Leveled Compaction is the statement ALTER TABLE

you listed above. While you are correct that changes to the file cassandra.yaml

will require a node (s) reload, there are usually no table configuration changes. It should use Leveled Compaction for this table the next time it starts compaction.



Also, you should read Tyler Hobbs' article titled When Use Leveled Compaction . Since you are new to Cassandra, let's take a look to make sure you have a suitable use case.

+2


source


You can change your compaction strategy exactly online. Cassandra will re-link all sstables, so only disk I / O is of concern. pre-2.1 , the old sstable is only replaced after the new sstable is created. after 2.1 , the new sstable can serve traffic at build time (mainly to preserve page cache, see CASSANDRA-6916). so basically your traffic won't be affected.



I know that some companies like netflix are doing this change through jmx host to prevent thunder storm. But I don't see any problems with ALTER TABLE

for our cluster.

0


source







All Articles