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 tarballs, run the following from the command line:

cassandra [OPTIONS]

For package installs, add the following to the /etc/cassandra/cassandra-env.sh file:

JVM_OPTS="$JVM_OPTS -D[PARAMETER]

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.

General options 

Option Description
-f Start the cassandra process in foreground. The default is to start as 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.

Start-up parameters 

-D parameter
Specifies the following start-up parameters:
cassandra.available_processors=number_of_processors
In a multi-instance deployment, multiple Cassandra instances will independently assume that all CPU processors are available to it. This setting allows you to specify a smaller set of processors and perhaps have affinity.
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=true|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 when you have changed node information in cassandra.yaml (such as listen_address).
cassandra.metricsReporterConfigFile=file
Enable pluggable metrics reporter. See Pluggable metrics reporting in Cassandra 2.0.2.
cassandra.native_transport_port=port
Set the port on which the CQL native transport listens for clients. (Default: 9042)
cassandra.partitioner=partitioner
Set the partitioner. (Default: org.apache.cassandra.dht.Murmur3Partitioner)
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.
  1. Remove all SSTables for counter tables on the node.
  2. Restart the node with the value of this parameter set to true.
  3. 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: The broadcast_address defaults to the listen_address except when using the Ec2MultiRegionSnitch.
cassandra.replayList=table
Allow restoring specific tables from an archived commit log.
cassandra.ring_delay_ms=ms
Allows overriding of the default RING_DELAY (1000ms), which is the amount of time a node waits before joining the ring.
cassandra.rpc_port=port
Set the port for the Thrift RPC service, which is used for client connections. (Default: 9160).
cassandra.ssl_storage_port=port
Set the SSL port for encrypted communication. (Default: 7001)
cassandra.start_native_transport=true|false
Enable or disable the native transport server. See start_native_transport in cassandra.yaml.
cassandra.start_rpc=true/false
Enable or disable the Thrift RPC server. (Default: true)
cassandra.storage_port=port
Set the port for inter-node communication. (Default: 7000)
cassandra.triggers_dir=directory
Set the default location for the trigger JARs. (Default: conf/triggers)
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. (Useful when 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 and do not join the cluster when already configured in the cassandra.yaml file:

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

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

  • Replacing 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