Open
Description
Dikshant Adhikari (dikshant) commented:
Our docs here says:
https://www.cockroachlabs.com/docs/stable/zone-config-extensions
Has a single example showcasing failover region. We should add more. For example:
3 main US regions (east, central, west) and then 2 far regions (EU and JP). Only follower reads would be done in the far regions (EU, JP). Minimize the cross-region write latency by having the 3 US regions as voters and the 2 far regions as non-voters.
// Define database regions
CREATE DATABASE db
PRIMARY REGION "us-west1"
REGIONS "us-central1", "us-east1", "europe-west1", "asia-northeast1"
SURVIVE REGION FAILURE;
CREATE TABLE regional_by_table (pk INT PRIMARY KEY) LOCALITY REGIONAL;
ALTER DATABASE db ALTER LOCALITY REGIONAL CONFIGURE ZONE USING
voter_constraints = '{+region=us-west1: 2, +region=us-central1: 2, +region=us-east1: 1}',
lease_preferences = '[[+region=us-west1], [+region=us-central1]]';
Implementing super regions
// Define database regions
ALTER DATABASE db SURVIVE REGION FAILURE;
ALTER DATABASE db ADD REGION "us-central1";
ALTER DATABASE db ADD REGION "europe-central1";
ALTER DATABASE db ADD REGION "europe-east1";
ALTER DATABASE db ALTER LOCALITY REGIONAL IN "us-east1" CONFIGURE ZONE USING
num_replicas = 5,
constraints = '{+region=us-east1: 2,
+region=us-central1: 2,
+region=us-west1: 1}',
lease_preferences = '[[+region=us-east1], [+region=us-central1]]';
ALTER DATABASE db ALTER LOCALITY REGIONAL IN "europe-central1" CONFIGURE ZONE USING
num_replicas = 5,
constraints = '{+region=europe-central1: 2,
+region=europe-west1: 2,
+region=europe-east1: 1}',
lease_preferences = '[[+region=europe-central1], [+region=europe-west1]]';
Jira Issue: DOC-8558