Skip to main content
Once you’ve installed CockroachDB, you can simulate multi-region cluster on your local machine using cockroach demoto learn about CockroachDB’s multi-region abstractions.
cockroach demo is not suitable for production deployments. Additionally, simulating multiple geographically distributed nodes on a single host is not representative of the performance you should expect in a production deployment. To learn more about production multi-region deployments, refer to Orchestrate CockroachDB Across Multiple Kubernetes Clusters and Deploy a Global, Serverless Application, and review the Production Checklist.

Before you begin

Download and Install CockroachDB.

Step 1. Start the cluster

Use the following cockroach demo command to start the cluster. This particular combination of flags results in a demo cluster of 9 nodes, with 3 nodes in each region. It sets the appropriate node localities and also simulates the network latency that would occur between nodes in these localities. For more information about each flag, see the cockroach demo documentation, especially for --global.
When the cluster starts, you’ll see a message like the one shown below, followed by a SQL prompt. Note the URLs for:

Step 2. Enter SQL statements at the prompt

Now that your simulated multi-region cluster is running, you are presented with a SQL prompt:
You can run some basic CockroachDB SQL statements:

Step 3. View cluster health and performance in the DB Console

The DB Console gives you insight into the overall health of your cluster, as well as the performance of any client workloads. To verify that the 9 nodes you specified are up and running as expected, go to the Cluster Overview at http://localhost:8080/#/overview/list.
Capacity metrics can be incorrect when running multiple nodes on a single machine. For more details, see this limitation.
To see which nodes are located in which regions, and to see the simulated latencies between them, go to the Network Diagnostics page at http://localhost:8080/#/reports/network/region To access a variety of time series charts, including graphs of SQL queries and SQL service latency, go to the Metrics page at http://localhost:8080/#/metrics You may also find the following pages useful:

Step 4. Wipe the cluster

When you’re done with your demo cluster, you can wipe the cluster by typing the command shown below at the SQL prompt. Note that because this is a temporary, in-memory cluster, this will wipe any data you have added to the cluster. For more information, see the cockroach demo documentation.

What’s next?