Single Leader Across Every Range

I am a new user of CockroachDB.

I have set up a local cluster with three nodes, but I noticed that there are multiple Raft instances across the ranges from the GUI. For instance, range 1 might have node 1 as the leader, range 7 might have node 2 as the leader, and range 10 might have node 3 as the leader. Instead, I want to prepare the cluster such that the leader for one range is also the leader for every range. Is there any way to configure the system in such a way?

Also, is there any way to configure the system such that there is only one range?

Hi @abyoo,

Welcome to Cockroach Forums!

Sorry for the delay in response.

To answer your questions:

There is no direct way to configure the raft leaders to a particular node. However, the Raft leader is almost always the same replica as the leaseholder, see here. You may configure the location of the leaseholder using the lease_preferences replication zone variable as described here and here

CockroachDB algorithmically starts distributing your data among your nodes, breaking the data up into default 64MiB chunks that we call ranges. As soon as a range reaches the default 64 MiB in size, it splits into two ranges. This process continues for these new ranges as the table and its indexes continue growing. You may configure the size at which a range will split using the range_max_bytes replication zone variable as described here. However, it is not recommended.

Please let me know if the above info answers your questions.

Technical Support Engineer