Running CrateDB

This document covers the basics of running CrateDB from the command line.

See also

For help installing CrateDB for the first time, check out Getting Started With CrateDB.

If you’re deploying CrateDB, check out the CrateDB Guide.

Table of Contents

Introduction

CrateDB ships with a crate command in the bin directory.

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

  1. 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:

  1. 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.

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

The crate executable supports the following command line options:

Command Line Options

OptionDescription
-dStart the daemon in the background
-hPrint usage information
-p <pidfile>Log the pid to a file
-vPrint version information
-CSet a CrateDB configuration value (overrides configuration file)
-DSet a Java system property value
-XSet a nonstandard java option

Example:

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

Signal Handling

The CrateDB process can handle the following signals.

SignalDescription
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.