Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Latest commit

 

History

History
50 lines (41 loc) · 1.49 KB

README.md

File metadata and controls

50 lines (41 loc) · 1.49 KB

Basic CockroachDB Cluster with HAProxy

Simple 3 node CockroachDB cluster with HAProxy acting as load balancer

Services

  • crdb-0 - CockroachDB node
  • crdb-1 - CockroachDB node
  • crdb-2 - CockroachDB node
  • lb - HAProxy acting as load balancer

Getting started

  1. run docker-compose up
  2. visit the CockroachDB UI @ http://localhost:8080
  3. visit the HAProxy UI @ http://localhost:8081
  4. have fun!

Helpful Commands

Execute SQL

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;"

Initialize and Run the TPC-C Workload

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"

Open Interactive Shells

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/sh

Stop Individual nodes

docker-compose stop crdb-0
docker-compose stop crdb-1
docker-compose stop crdb-2