Simple 3 node CockroachDB cluster with HAProxy acting as load balancer
crdb-0- CockroachDB nodecrdb-1- CockroachDB nodecrdb-2- CockroachDB nodelb- HAProxy acting as load balancer
- run
docker-compose up - visit the CockroachDB UI @ http://localhost:8080
- visit the HAProxy UI @ http://localhost:8081
- have fun!
Use the following to execute arbitrary SQL on the CockroachDB cluster. The following creates a database called test.
docker-compose exec crdb-0 /cockroach/cockroach sql --insecure --execute="CREATE DATABASE test;"Use the following commands to initialize and run the tpcc sample workload. For more details see this.
to initialize...
docker-compose exec crdb-0 /cockroach/cockroach workload init tpcc "postgresql://root@localhost:26257?sslmode=disable"to run for 10m...
docker-compose exec crdb-0 /cockroach/cockroach workload run tpcc --duration=10m "postgresql://root@localhost:26257?sslmode=disable"docker exec -ti crdb-0 /bin/bash
docker exec -ti crdb-1 /bin/bash
docker exec -ti crdb-2 /bin/bash
docker exec -ti lb /bin/shdocker-compose stop crdb-0
docker-compose stop crdb-1
docker-compose stop crdb-2