4

I am new to Cassandra and have a basic question regarding its partitioners.

According to the Cassandra document, the partitioner of a cluster should be set in the cassandra.yaml file. My question is: does this mean all keyspaces in a Cassandra cluster must use the same partitioner? If it's not, how to allow different keyspaces to use different partitioners?

keelar
  • 5,814
  • 7
  • 40
  • 79

1 Answers1

4

All keyspaces must use the same partitioner. This is to avoid requiring excessive configuration for each keyspace. However, you can choose replication options per keyspace: whether you want multiple datacenter replication and replication factors.

Richard
  • 11,050
  • 2
  • 46
  • 33
  • Thank you for your answer! But I don't get the "This is to avoid requiring excessive configuration for each keyspace." part. I think it is fine to have a default partitioner set in the config file, and allow each keyspace to overwrite the setting. Does Cassandra offer this? – keelar Aug 08 '13 at 07:01
  • No, the partitioner cannot be overridden per keyspace. It would require setting tokens for each keyspace and would make a lot of operations more complex. Also, you are very strongly encouraged to use the default (Murmur3Partitioner in 1.2.x) for everything. – Richard Aug 08 '13 at 07:03
  • I know that one is recommended, but I would like some of my column-families to be partitioned by the `ByteOrderedPartitioner`, which orders the key. Or is it a bad idea? – keelar Aug 08 '13 at 07:06
  • It means you have to do manual balancing regularly. You also can't use virtual nodes. – Richard Aug 08 '13 at 07:08
  • Yes, but there are some cases that are required to process data in some order, so in this case is the Murmur3 still the king? – keelar Aug 08 '13 at 07:15
  • 1
    Murmur3 is still a hash based partitioner, so you can't do ordered range queries on rows. Instead you should use wide rows and range queries on columns. – Richard Aug 08 '13 at 07:26
  • 2
    What he means is, "take advantage of clustering [ordering] within a partition." :) – jbellis Aug 08 '13 at 15:45