Command Line Interface

Table of Contents

The Basics

After downloading and extracting the tarball (see Download) you will be able to invoke the CrateDB command in the bin directory. The excutable is named crate.

The simplest way to start a CrateDB instance is to invoke crate without parameters. This will start the process in the foreground.

sh$ ./bin/crate

You can also start CrateDB in the background using the -d option. When starting CrateDB in the background it is helpful to write the process ID into a pid file so you can find out the process id easlily:

sh$ ./bin/crate -d -p ./crate.pid

To stop the process that is running in the background send the TERM or INT signal to it.

sh$ kill -TERM `cat ./crate.pid`

The crate executable supports the following command line options:

Command Line Options

Option Description
-d Start the daemon in the background
-h Print usage information
-p <pidfile> Log the pid to a file
-v Print version information
-C Set a CrateDB configuration value (overrides configuration file)
-D Set a Java system property value
-X Set a nonstandard java option

Example:

sh$ ./bin/crate -d -p ./crate.pid

Signal Handling

The CrateDB process can handle the following signals.

Signal Description
TERM

Stops a running CrateDB process

kill -TERM `cat /path/to/pidfile.pid`

INT

Stops a running CrateDB process

Same behaviour as TERM.

USR2

Stops a running CrateDB process gracefully. See Rolling Upgrade for more information

kill -USR2 `cat /path/to/pidfile.pid`

USR2 is not supported on Windows.