Skip to content

Instantly share code, notes, and snippets.

@bdarnell
Created September 21, 2015 17:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bdarnell/5f592eaeb66d28ddb9e8 to your computer and use it in GitHub Desktop.
Save bdarnell/5f592eaeb66d28ddb9e8 to your computer and use it in GitHub Desktop.
Scripts for running multi-node cockroachdb cluster

Run make build in the cockroach repo and copy the binary to ./bin/cockroach (relative to wherever you have downloaded these scripts).

Run init.sh once, then run start.sh 1, start.sh 2, and start.sh 3 in separate terminals. After that, run shell.sh to start a SQL shell.

To wipe everything and start over, kill all the processes started by start.sh and delete the node* directories.

#!/bin/bash
mkdir -p node1 node2 node3
set -ux
bin/cockroach cert create-ca
bin/cockroach cert create-node 127.0.0.1 localhost $(hostname)
bin/cockroach cert create-client root
bin/cockroach init --stores=ssd=node1
#!/bin/bash
set -x
exec bin/cockroach sql --addr=localhost:4001
#!/bin/bash
set -ux
N=$1
exec bin/cockroach start --stores=ssd=node$N --addr=localhost:400$N --gossip=localhost:4001,localhost:4002,localhost:4003
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment