To stop a CockroachDB node running in the background, run the cockroach quit command with appropriate flags. To stop a node running in the foreground, use CTRL + C or run cockroach quit from another shell.

The quit command allows in-flight requests to complete and then shuts down the node. Once a node has been offline for approximately 5 minutes, CockroachDB automatically rebalances replicas from the missing node, using unaffected replicas on other nodes as sources.

Synopsis

# Stop a node:
$ cockroach quit <flags>

# View help:
$ cockroach quit --help

Flags

The quit command supports the following flags as well as logging flags.

Flag Description
--ca-cert The path to the CA certificate. This flag is required if the cluster is secure.

Env Variable: COCKROACH_CA_CERT
--cert The path to the client certificate. This flag is required if the cluster is secure.

Env Variable: COCKROACH_CERT
--host The server host to connect to. This can be the address of any node in the cluster.

Env Variable: COCKROACH_HOST
Default: localhost
--insecure Set this only if the cluster is insecure and running on multiple machines.

If the cluster is insecure and local, leave this out. If the cluster is secure, leave this out and set the --ca-cert, --cert, and -key flags.

Env Variable: COCKROACH_INSECURE
--key The path to the client key protecting the client certificate. This flag is required if the cluster is secure.

Env Variable: COCKROACH_KEY
--port The server port to connect to.

Env Variable: COCKROACH_PORT
Default: 26257

Example

Shut down a node

# Insecure:
$ cockroach quit --host=nodehostname.com --port=26258

# Secure:
$ cockroach quit --ca-cert=certs/ca.cert --cert=certs/node.cert --key=certs/node.key --host=nodehostname.com --port=26258

See Also

Other Cockroach Commands



Yes No