Simple multi-node example that demonstrates basic locality and partitioning concepts across three virtual data centers and a handful of simple tables pinned to different localities.
east_only
table is pinned to theeast
data center onlycentral_only
table is pinned to thecentral
data center onlywest_only
table is pinned to thewest
data center onlyeast_central
table is pinned to theeast
andwest
data centerscentral_west
table is pinned to thecentral
andwest
data centers
This distribution can be verified by the SQL commands below or via the UI... http://localhost:8001/#/data-distribution.
east-1
- CockroachDB node ineast
data centereast-2
- CockroachDB node ineast
data centereast-3
- CockroachDB node ineast
data centercentral-1
- CockroachDB node incentral
data centercentral-2
- CockroachDB node incentral
data centercentral-3
- CockroachDB node incentral
data centerwest-1
- CockroachDB node inwest
data centerwest-2
- CockroachDB node inwest
data centerwest-3
- CockroachDB node inwest
data center
- because operation order is important, execute
./up.sh
instead ofdocker-compose up
- visit the CockroachDB UI @ http://localhost:8001
- have fun!
docker exec -ti east-1 /bin/bash
docker exec -ti east-2 /bin/bash
docker exec -ti east-3 /bin/bash
docker exec -ti central-1 /bin/bash
docker exec -ti central-2 /bin/bash
docker exec -ti central-3 /bin/bash
docker exec -ti west-1 /bin/bash
docker exec -ti west-2 /bin/bash
docker exec -ti west-3 /bin/bash