Last active
November 20, 2022 06:33
-
-
Save a-robinson/368d79e8b9b438d59bd819a7566710be to your computer and use it in GitHub Desktop.
Docker compose file for 3-datacenter cockroachdb cluster with 2 nodes in each datacenter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker network disconnect "${PWD##*/}_shared" roach-4 | |
docker network disconnect "${PWD##*/}_shared" roach-5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2.1' | |
networks: | |
shared: | |
driver: bridge | |
dc0: | |
driver: bridge | |
dc1: | |
driver: bridge | |
dc2: | |
driver: bridge | |
services: | |
# DC 0 ROACHES | |
roach-0: | |
container_name: roach-0 | |
image: cockroachdb/cockroach:${COCKROACH_VERSION:-v1.1.5} | |
networks: | |
- shared | |
- dc0 | |
command: start --logtostderr --insecure --locality=datacenter=dc-0 --join=roach-0,roach-1,roach-2 | |
ports: | |
- 8000:8080 | |
- 9000:26257 | |
roach-1: | |
container_name: roach-1 | |
image: cockroachdb/cockroach:${COCKROACH_VERSION:-v1.1.5} | |
networks: | |
- shared | |
- dc0 | |
command: start --logtostderr --insecure --locality=datacenter=dc-0 --join=roach-0,roach-1,roach-2 | |
ports: | |
- 8001:8080 | |
- 9001:26257 | |
# DC 1 ROACHES | |
roach-2: | |
container_name: roach-2 | |
image: cockroachdb/cockroach:${COCKROACH_VERSION:-v1.1.5} | |
networks: | |
- shared | |
- dc1 | |
command: start --logtostderr --insecure --locality=datacenter=dc-1 --join=roach-0,roach-1,roach-2 | |
ports: | |
- 8002:8080 | |
- 9002:26257 | |
roach-3: | |
container_name: roach-3 | |
image: cockroachdb/cockroach:${COCKROACH_VERSION:-v1.1.5} | |
networks: | |
- shared | |
- dc1 | |
command: start --logtostderr --insecure --locality=datacenter=dc-1 --join=roach-0,roach-1,roach-2 | |
ports: | |
- 8003:8080 | |
- 9003:26257 | |
# DC 2 ROACHES | |
roach-4: | |
container_name: roach-4 | |
image: cockroachdb/cockroach:${COCKROACH_VERSION:-v1.1.5} | |
networks: | |
- shared | |
- dc2 | |
command: start --logtostderr --insecure --locality=datacenter=dc-2 --join=roach-0,roach-1,roach-2 | |
ports: | |
- 8004:8080 | |
- 9004:26257 | |
roach-5: | |
container_name: roach-5 | |
image: cockroachdb/cockroach:${COCKROACH_VERSION:-v1.1.5} | |
networks: | |
- shared | |
- dc2 | |
command: start --logtostderr --insecure --locality=datacenter=dc-2 --join=roach-0,roach-1,roach-2 | |
ports: | |
- 8005:8080 | |
- 9005:26257 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker exec -it roach-0 /cockroach/cockroach init --insecure |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment