Currently running a 3 node cluster with replication factor 3 on the keyspaces. Need to add more nodes to the cluster as the size of each node is approaching 2TB. Can I add just 1 more node to the cluster and have a 4 node cluster or does the cluster always need to have odd number of nodes? Using a consistency level of ONE currently for both read and write.
2 Answers
You can have as many nodes in the cluster as you want, particularly if you are not using the racks feature in Cassandra (all nodes are in the same logical C* rack).
If you are using C* racks, our recommendation is to have an equal number of nodes in each rack so the load distribution is balanced across the racks in each DC.
For example, if your app keyspaces have a replication factor of 3 and you have 3 racks then the number of nodes in the DC should be in multiples of the replication factor -- 3, 6, 9, 12 and so on. This would allow you to configure the same number of nodes in each rack.
This isn't a hard requirement but is best practice so nodes have an equal amount of load and data on them. Cheers!
-
1Totally agree. You'll get the best data distribution by going with a number of nodes that are a factor of your RF.– AaronCommented Jul 21, 2021 at 13:51
-
-
So I could have any number of cassandra nodes if I am using a single rack with replication factor of 3? Commented Nov 6, 2023 at 11:55
-
1
You can have even number of nodes in a Cassandra cluster. So you can add another node to the cluster. If you are using vnodes, then it will be easier, otherwise a lot of work needs to be done to balance the cluster.
One more thing, reading and writing with consistency level ONE
decreases the consistency. If it suits your usecase then it is fine but general recommendation is to use QUORUM
on the production system.
-
2The argument I'd counter with here, is that Cassandra is an AP eventually-consistent database, and utilizing lower consistency works with that intended design. I actually recommend dev teams start with (LOCAL) ONE, and go to (LOCAL) QUORUM only if they notice consistency issues.– AaronCommented Jul 21, 2021 at 13:54
-
-