Search code examples
nodescockroachdb

Distribution on nodes


I started a CockroachDb in a SIngel cluster with 5 nodes and try to store a table on 3 Specific Nodes. Unfortunately it does not work. Since someone has experience with this

ALTER TABLE belegdaten CONFIGURE ZONE USING num_replicas = 3, constraints = '[+ 1, + 2, + 3, - 4, - 5]';


Solution

  • CockroachDB doesn't distribute data like what you are trying to do.

    To do something like what you want, you can set up your cluster as a multiregion cluster and use regional tables and data domiciling. You'd make the 3 nodes a particular region, then set the locality of the tables you want to the same region. In this scenario, you'd really want a six node cluster with 2 regions each with 3 nodes.

    But I'm confused about the use-case here. Why is it important for the tables to be replicated to 3 and only 3 nodes in the cluster? What is the purpose of the other 2 nodes? With CockroachDB you can connect to any node and retrieve the data, even if it's not a replica of the range.