The cassandra utility

Cassandra start-up parameters can be run from the command line (in Tarball installations) or specified in the cassandra-env.sh file (Package or Tarball installations).

Cassandra start-up parameters can be run from the command line (in Tarball installations) or specified in the cassandra-env.sh file (Package or Tarball installations).

Usage for tarball installs 

From the command line:

cassandra [OPTIONS]

Usage for package installs 

In the /etc/cassandra/cassandra-env.sh file:

Include file 

For convenience on Linux installations, Cassandra uses an include file, cassandra.in.sh , to source these environment variables. Use the following locations for this file:

  • Tarball installs: install_location /bin
  • Packaged installs: /usr/share/cassandra

Cassandra also uses the Java options set in cassandra-env.sh. If you want to pass additional options to the Java virtual machine, such as maximum and minimum heap size, edit the options in this file rather than setting them in the environment.

  • Tarball installs: install_location /conf
  • Packaged installs: /etc/cassandra
Options
Option Description
-f Start the cassandra process in foreground (default is to start as a background process).
-h Help.
-p filename Log the process ID in the named file. Useful for stopping Cassandra by killing its PID.
-v Print the version and exit.
-D parameter Passes in one of the following startup parameters:
cassandra.config= directory
The directory location of the cassandra.yaml file.
cassandra.initial_token= token
Sets the initial partitioner token for a node the first time the node is started.
cassandra.join_ring=t rue|false
Set to false to start Cassandra on a node but not have the node join the cluster.
cassandra.load_ring_state= true|false
Set to false to clear all gossip state for the node on restart. Use if you have changed node information in cassandra.yaml (such as listen_address).
cassandra.renew_counter_id= true|false
Set to true to reset local counter info on a node. Used to recover from data loss to a counter table. First remove all SSTables for counter tables on the node, then restart the node with -Dcassandra.renew_counter_id=true , then run nodetool repair once the node is up again.
cassandra.replace_address=listen_address or broadcast_address of dead node 
To replace a node that has died, restart a new node in its place specifying the listen_address or broadcast_address that the new node is assuming. The new node must not have any data in its data directory, that is, it must be in the same state as before bootstrapping.
Note: Note: The broadcast_address defaults to the listen_address except when using the EC2MultiRegionSnitch.
cassandra.write_survey= true  
For testing new compaction and compression strategies. It allows you to experiment with different strategies and benchmark write performance differences without affecting the production workload. See Testing compaction and compression.

Example

  • Clear gossip state when starting a node. This is useful if the node has changed its configuration, such as its listen IP address:

    Command line: bin/cassandra -Dcassandra.load_ring_state=false

    cassandra-env.sh: JVM_OPTS="$JVM_OPTS -Dcassandra.load_ring_state=false

  • Start Cassandra on a node in stand-alone mode and do not join the cluster when already configured in the cassandra.yaml file:

    Command line: bin/cassandra -Dcassandra.join_ring_state=false

    cassandra-env.sh: JVM_OPTS="$JVM_OPTS -Dcassandra.join_ring_state=false

  • Replace a dead node:

    Command line: bin/cassandra -Dcassandra.replace_address=10.91.176.160

    cassandra-env.sh: JVM_OPTS="$JVM_OPTS -Dcassandra.replace_address=10.91.176.160

Related topics

The cassandra.yaml configuration file