Reputation: 2660
I'm trying to add a new node into existing cluster and allocate_tokens_for_local_replication_factor
is 2
for the current nodes but the default value from newly installed Cassandra is 3
. I was tried to find information about this configuration but can't find a clear description how this configuration is working.
Upvotes: 1
Views: 810
Reputation: 16393
The allocate_tokens_for_local_replication_factor
works in much the same way as allocate_tokens_for_keyspace
where it triggers an algorithm that attempts to choose tokens such that the load (data density) is balanced or optimised for the nodes in the local data centre.
The main difference is that allocate_tokens_for_local_replication_factor
optimises the algorithm for a defined replication factor of 3 (default) instead of the replication factor for a given keyspace (allocate_tokens_for_keyspace
).
allocate_tokens_for_keyspace
was added in Cassandra 3.0 (CASSANDRA-7032) to improve token allocation for clusters configured with virtual nodes. However, it suffers from the problem where the replication factor of a keyspace cannot be used when adding a new DC since the keyspace is not replicated to the new DC yet.
Cassandra 4.0 solved this problem by allowing operators to specify the replication factor to be used for optimising the token allocation algorithm with allocate_tokens_for_local_replication_factor
(CASSANDRA-15260).
In your case where the existing nodes have:
allocate_tokens_for_local_replication_factor: 2
a previous operator would have configured it that way because the application keyspace(s) had a replication factor of 2.
As a side note, thanks for bringing this to our attention. I have logged CASSANDRA-17984 so we could improve the docs. Cheers!
Upvotes: 2