Skip to main content
This page introduces the cockroach commands for configuring, starting, and managing a CockroachDB cluster, as well as environment variables that can be used in place of certain flags. You can run cockroach help in your shell to get similar guidance.

Commands

Environment variables

For many common cockroach flags, such as --port and --user, you can set environment variables once instead of manually passing the flags each time you execute commands.
  • To find out which flags support environment variables, see the documentation for each command.
  • To output the current configuration of CockroachDB and other environment variables, run env.
  • When a node uses environment variables on , the variable names are printed to the node’s logs; however, the variable values are not.
CockroachDB prioritizes command flags, environment variables, and defaults as follows:
  1. If a flag is set for a command, CockroachDB uses it.
  2. If a flag is not set for a command, CockroachDB uses the corresponding environment variable.
  3. If neither the flag nor environment variable is set, CockroachDB uses the default for the flag.
  4. If there’s no flag default, CockroachDB gives an error.
For more details, see .