Skip to main content
This page explains the 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:
View help:

Flags

The cockroach 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 the cockroach 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 run cockroach start-single-node, some helpful details are printed to the standard output:
These details are also written to the INFO log in the /logs directory. You can retrieve them with a command like grep 'node starting' node1/logs/cockroach.log -A 11.

Examples

Start a single-node cluster

  1. Create two directories for certificates:
  1. Create the CA (Certificate Authority) certificate and key pair:
  2. Create the certificate and key pair for the node:
  3. Create a client certificate and key pair for the root user:
  4. Start the single-node cluster:

Scale to multiple nodes

Scaling a cluster started with cockroach 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.
  1. Stop the single-node cluster: Get the process ID of the node:
    Gracefully shut down the node, specifying its process ID:
  2. 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 --join flag when starting other nodes as well. For a cluster in a single region, set 3-5 --join addresses. 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.
  3. In new terminal windows, add two more nodes:
    These commands are the same as before but with unique --store, --listen-addr, and --http-addr flags, 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.
  4. Open the :
  5. Update preconfigured to replicate user data 3 times and import internal data 5 times:
  6. Stop the single-node cluster: Get the process ID of the node:
    Gracefully shut down the node, specifying its process ID:
  7. 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 --join flag when starting other nodes as well.
  8. In new terminal windows, add two more nodes:
    These commands are the same as before but with unique --store, --listen-addr, and --http-addr flags, since this all nodes are running on the same machine.
  9. Open the :
  10. 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: