local cockroach db code example

Example: how start cluster in cockroachDB

#Starting the Cluster in crockroachDB in windows

#Note in Windows powershell you cant use the --background flag
#so alertnate to it is using the 
>>start powershell    ------------>this would load up new shell for every node initialization

cockroach start --insecure --listen-addr=localhost:26257 --join=localhost:26257,localhost:26258,localhost:26259 `
  --http-addr=localhost:8080 --store=cockroach-data-1
cockroach start --insecure --listen-addr=localhost:26257 --join=localhost:26257,localhost:26258,localhost:26259 `
  --http-addr=localhost:8081 --store=cockroach-data-2  # This will error out
cockroach start --insecure --listen-addr=localhost:26258 --join=localhost:26257,localhost:26258,localhost:26259 `
  --http-addr=localhost:8081 --store=cockroach-data-2 
cockroach start --insecure --listen-addr=localhost:26259 --join=localhost:26257,localhost:26258,localhost:26259 `
--http-addr=localhost:8082 --store=cockroach-data-3 

cockroach init --host localhost:26258 --insecure

cockroach start --insecure --listen-addr=localhost:26260 \
  --join=localhost:26257,localhost:26258,localhost:26259,localhost:26260,localhost:26261 \
  --http-addr=localhost:8083 --store=cockroach-data-4
cockroach start --insecure --listen-addr=localhost:26261 \
  --join=localhost:26257,localhost:26258,localhost:26259,localhost:26260,localhost:26261 \
  --http-addr=localhost:8084 --store=cockroach-data-5