cockroach start-single-node , which you use to start a single-node cluster with replication disabled. A single-node cluster is appropriate for quick SQL testing or app development.
A single-node cluster is not appropriate for use in production or for performance testing. To run a multi-node cluster with replicated data for availability, consistency and resiliency, including load balancing across multiple nodes, use and to start a multi-node cluster with a minimum of three nodes instead.
Synopsis
Start a single-node cluster:Flags
Thecockroach start-single-node command supports the following general-use, networking, security, and logging flags.
Many flags have useful defaults that can be overridden by specifying the flags explicitly. If you specify flags explicitly, however, be sure to do so each time the node is restarted, as they will not be remembered.
The
cockroach start-single-node flags are identical to flags. However, many of them are not relevant for single-node clusters but are provided for users who want to test concepts that appear in multi-node clusters. These flags are called out as such. In most cases, accepting most defaults is sufficient (see the examples below).General
Networking
Security
Store
The--store flag supports the following fields. Note that commas are used to separate fields, and so are forbidden in all field values.
In-memory storage is not suitable for production deployments at this time.
Logging
By default,cockroach start-single-node writes all messages to log files, and prints nothing to stderr. This includes events with INFO and higher. However, you can of this command by using the --log flag:
Defaults
See the .Docker-specific features of single-node clusters
When you use thecockroach start-single-node command to start a single-node cluster with Docker, some additional features are available to help with testing and development. Refer to and .
Standard output
When you runcockroach start-single-node, some helpful details are printed to the standard output:
Examples
Start a single-node cluster
-
Create two directories for certificates:
-
Create the CA (Certificate Authority) certificate and key pair:
-
Create the certificate and key pair for the node:
-
Create a client certificate and key pair for the
rootuser: -
Start the single-node cluster:
Scale to multiple nodes
Scaling a cluster started withcockroach start-single-node involves restarting the first node with the cockroach start command instead, and then adding new nodes with that command as well, all using a --join flag that forms them into a single multi-node cluster. Since replication is disabled in clusters started with start-single-node, you also need to enable replication to get CockroachDB’s availability and consistency guarantees.
-
Stop the single-node cluster:
Get the process ID of the node:
Gracefully shut down the node, specifying its process ID:
-
Restart the node with the command:
The new flag to note is
--join, which specifies the addresses and ports of the nodes that will initially comprise your cluster. You’ll use this exact--joinflag when starting other nodes as well. For a cluster in a single region, set 3-5--joinaddresses. Each starting node will attempt to contact one of the join hosts. In case a join host cannot be reached, the node will try another address on the list until it can join the gossip network. -
In new terminal windows, add two more nodes:
These commands are the same as before but with unique
--store,--listen-addr, and--http-addrflags, since this all nodes are running on the same machine. Also, since all nodes use the same hostname (localhost), you can use the first node’s certificate. Note that this is different than running a production cluster, where you would need to generate a certificate and key for each node, issued to all common names and IP addresses you might use to refer to the node as well as to any load balancer instances. -
Open the :
-
Update preconfigured to replicate user data 3 times and import internal data 5 times:
-
Stop the single-node cluster:
Get the process ID of the node:
Gracefully shut down the node, specifying its process ID:
-
Restart the node with the command:
The new flag to note is
--join, which specifies the addresses and ports of the nodes that will comprise your cluster. You’ll use this exact--joinflag when starting other nodes as well. -
In new terminal windows, add two more nodes:
These commands are the same as before but with unique
--store,--listen-addr, and--http-addrflags, since this all nodes are running on the same machine. -
Open the :
-
Update preconfigured to replicate user data 3 times and import internal data 5 times:
See also
- Running a local multi-node cluster:
- Running a distributed multi-node cluster:

