0
votes

Lets say I have two Data Centers(DC1, DC2) in a Single Cassandra cluster.

DC1 - 4 nodes. DC2 - 4 nodes.

Initially i have set the replication factor for all the keyspaces to be {DC1:2 , DC2:2}.(Network topology strategy)

But After some time lets say I alter the keyspace and change the replication factor to {DC:2} for all the keyspaces.(removing DC1).No replication factor for DC1.

So now what will happen? Will DC1 get any data written into it in the future? Will all the token ranges be assigned to only DC2?

1
This is a bit of a weird question, why didn't you just set up an example cluster and tried it out? :) Anyway, in this case, Cassandra will behave exactly like you expected. Nothing more will be written to DC1, all the token ranges will be assigned to only DC2.Jan Dörrenhaus
What happens to the existing data in DC1? How will it be read if all the token ranges are assigned only to DC2?Meenakshisundaram
Data will be read only from DC2, then.Jan Dörrenhaus

1 Answers

2
votes

If you exclude DC1 - it won't get data written for that keyspace, nor data will be read from the DC1. Before switching off DC1, make sure that you perform nodetool repair on the serves in DC2, to make sure that you have all data synchronized. After changing RF, you

When you change RF for specific keyspace, drivers and Cassandra itself recalculate the token ranges assignments taking into account information about data centers.