How 'Replicas per Node' works?

I understand the default number of replicas is 3 per zone.
But I’m confused how ‘Replicas per Node’ works. It’s sometimes more than 20.
What happens if Capacity is going down? No changes on the count of replicas?

The default number of replicas is 3 per range.
Ranges are automatically split when they reach a certain size (64MB). Separate ranges are also created for every database and table. The combination of both factors means that a cockroach cluster can reach thousands or even millions of ranges.
For each of those ranges, we will default to three replicas spread across multiple nodes.

This means that you should expect to see X ranges across the entire cluster and 3*X replicas when summing up across all nodes.
When you see that a node holds 20 ranges (for example), it means that it is holding one copy of twenty different ranges.

Ranges/replicas regularly get split (replacing the existing range with two new ones covering the same keys), rebalanced (replica is moved from one node to another due to load/fullness), and recovered (copied from one node to another when an existing node is down).

1 Like

Thank you so much :-))