Change replication factor


Hi there.

While playing with CRDB, I found that I am able to change the replication factor from the default 3 (so that I can survive the loss of (replication_factor - 1)/2 nodes).
That said, is there an easy way to change the replication factor of my database, but also including the system’s tables replication factor?

Thanks in advance,

(Jesse) #2

Hi @marigonzes,

In CockroachDB v2.0, you need to manually change the replication factor for system data. This tutorial has a demonstration. There’s also an example in the replication zone documentation.

In CockroachDB v2.1, we may do this automatically when the .default replication factor is increased, but I’m not sure. I’ll look into it and post an update here.



Thanks. I’m looking forward to know if the change in CRDB v2.1 goes live or not.
Because it’s kind of a pain to change the replication factor of the system data and it is error prone. I am thinking of a situation in which I forget to update one of them and despite thinking my cluster will survive loosing N servers, it is not quite like that.

(Jesse) #4

Hi @marigonzes,

I just found out that, in 2.1, the pre-configured replication zones for system data won’t auto-update when the .default replication is changed. That will be implemented in 2.2. However, in 2.1, the replication factor for important system replication zones will be pre-set to 5, which will significantly decrease the chance of the system data becoming unavailable.



Thanks for the follow-up, @jesse. Guess I will have to wait for v2.2 then.
Just one more thing, does the change in v2.1 mean that the minimum number of nodes will be 5?

(Raphael 'kena' Poss) #6

No in 2.1 the minimum number of nodes will be 1.

The new default of 5 means that the replication will automatically grow with your cluster size until 5 replicas can exist. But as long as there are less than 5 nodes, the cluster will work with the number you have.