Currently there is setup of cockroach DB with 3 nodes in one datacenter and there are 7 such datacenter (so total 21 nodes). Writes/reads can happen in any datacenter. But with current deployment the reads goes to farther node causing much latency. I read about follower reads but what is not clear is how to make sure there is at least one replica in each datacenter. Currently the replication factor is 3 so it stores in any of the 3 nodes out of 21 nodes. At least for reads, I want to make sure it happens from within that datacenter. Also I see that follower reads is an enterprise feature. So want to know any solution for this in community/opensource version. version used is 19.1.4
You can use lease preferences to determine where the leaders are. See Configure Replication Zones | CockroachDB Docs for more info.
We would also encourage you to upgrade if possible since 19.1 is pretty unsupported right now.