Jump to: navigation, search

Santhosh Annamalai

Installing and Configuring Cassandra

Installing Cassandra4

Complete this procedure for each Cassandra node.

Prerequisites

  • For new deployments, we recommend Cassandra 4.1.x. The procedures below are meant to serve as a quick guide on how to do this. For more detailed information, see the Cassandra 4.1 documentation.
  • You have installed the latest supported openJDK 11.

Start

  1. Download the latest 4.1.x version of Cassandra.
  2. Copy the Cassandra archive to the installation directory. For example, /usr/local
  3. Use a tar utility to extract the files. For example, tar -zxvf apache-cassandra-4.1.4-bin.tar.gz
  4. Add directories for data, commitlog, and saved_caches. You can create these directories anywhere or in the default locations configured in the Cassandra_install_dir/conf/cassandra.yaml file. For example:
    • /var/lib/cassandra/data
    • /var/lib/cassandra/commitlog
    • /var/lib/cassandra/saved_caches

End

Configuring Cassandra4

The procedures below describe how to create the Cassandra keyspace for the following scenarios:

  • Development: 1 Cassandra node (appropriate for a development or lab environment)
  • Single Datacenter: 1 datacenter with a minimum of three Cassandra nodes
Important
For more complex Cassandra deployments, please consult with Genesys

Select one of the procedures that matches your deployment scenario.

Development

Configuring Cassandra (1 Cassandra node)

Important
The files modified in this procedure are typically found in the Cassandra_install_dir/conf directory.

Prerequisites

Start

  1. Modify the cassandra.yaml file:
    1. Set cluster_name to the desired name.
    2. Set seeds to the list of host name of the node. For example: -seeds: “127.0.0.1”
    3. Set listen_address and broadcast_address to the IP of the node.
    4. Set data_file_directories, commitlog_directory, and saved_caches_directory to the directories you created in Step 4 of Installing Cassandra4.
    5. Set the endpoint_snitch parameter to SimpleSnitch (for development only).
  2. Save your changes and close the file.

End

Single Datacenter

Configuring Cassandra (1 datacenter)

Complete the steps below for each node.

Important
The files modified in this procedure are typically found in the Cassandra_install_dir/conf directory.

Prerequisites

Start

  1. Modify the cassandra.yaml file:
    1. Set the cluster_name. It must be the same name on all nodes.
    2. Set seeds to the list of host names of all nodes. For example: -seeds: "node1, node2, node3"
    3. Set listen_address and broadcast_address to the IP of the node.
    4. Set data_file_directories, commitlog_directory, and saved_caches_directory to the directories you created in Step 4 of Installing Cassandra4.
    5. Set the start_rpc parameter to true.
    6. Change endpoint_snitch to GossipingPropertyFileSnitch.
  2. Save your changes and close the file.
  3. Open the cassandra-rackdc.properties file and update for your cluster topology. For each node in your cluster, add the following line:
    dc=[datacenter] rack=[rackname]

    Where:

    • [datacenter] is the name of the datacenter for this node.
    • [rackname] is the name of the rack for this node.

    The following is a sample cassandra-rackdc.properties file for a Single Datacenter scenario:

    dc=datacenter1   rack=rack1
  4. Save your changes and close the file.

End

Two Datacenters

Configuring Cassandra (2 datacenters)

Complete the steps below for each node.

Important
The files modified in this procedure are typically found in the Cassandra_install_dir/conf directory.

Prerequisites

Start

  1. Modify the cassandra.yaml file:
    1. Set the cluster_name. It must be the same name on all nodes.
    2. Set seeds to the list of host names of all nodes. For example: -seeds: "node1, node2, node3, node4, node5, node6"
    3. Set listen_address and broadcast_address to the host name.
    4. Set data_file_directories, commitlog_directory, and saved_caches_directory to the directories you created in Step 4 of Installing Cassandra4.
    5. Change endpoint_snitch to GossipingPropertyFileSnitch.
  2. Save your changes and close the file.
  3. Open the cassandra-rackdc.properties file and update for your cluster topology. For each node in your cluster, add the following line:
    dc=[datacenter] rack=[rackname]

    Where:

    • [datacenter] is the name of the datacenter for this node.
    • [rackname] is the name of the rack for this node.

    The following is a sample cassandra-rackdc.properties file for a Two Datacenter scenario:

    For datacenter1 nodes:

    dc=datacenter1   rack=rack1

    For datacenter2 nodes:

    dc=datacenter2   rack=rack1
  4. Save your changes and close the file.

End


Verifying the Cassandra4 installation

Prerequisites

Start

  1. Start all Cassandra nodes using the following command: Cassandra_install_dir/bin/cassandra -R
  2. Use the nodetool utility to verify that all nodes are connected by entering the following command: Cassandra_install_dir/bin/nodetool status

    The following is sample output for a Single Datacenter scenario with three Cassandra nodes:
    /genesys/apache-cassandra-4.1.4/bin$ ./nodetool status
    Address     DC           Rack   Status  State   Load      Owns     Token
    192.0.2.10  datacenter1  rack1  Up      Normal  14.97 MB  100.00%  -9223372036854775808
    192.0.2.11  datacenter1  rack1  Up      Normal  14.97 MB  100.00%  -3074457345618258603
    192.0.2.12  datacenter1  rack1  Up      Normal  14.97 MB  100.00%   3074457345618258602

    The following is sample output for a Development scenario with a single Cassandra node:

    /genesys/apache-cassandra-4.1.4/bin$ ./nodetool status
    Address         DC          Rack        Status State   Load            Effective-Ownership Token                                       
    127.0.0.1       datacenter1 rack1       Up     Normal  1.89 MB         100.00%             76880863635469966884037445232169973201

End

Installing Cassandra2

Complete this procedure for each Cassandra node.

Prerequisites

Start

  1. Download the latest 2.2.x version of Cassandra.
  2. Copy the Cassandra archive to the installation directory. For example, /usr/local
  3. Use a tar utility to extract the files. For example, tar -zxvf apache-cassandra-2.2.7-bin.tar.gz
  4. Add directories for data, commitlog, and saved_caches. You can create these directories anywhere or in the default locations configured in the Cassandra_install_dir/conf/cassandra.yaml file. For example:
    • /var/lib/cassandra/data
    • /var/lib/cassandra/commitlog
    • /var/lib/cassandra/saved_caches

End

Configuring Cassandra2

The procedures below describe how to create the Cassandra keyspace for the following scenarios:

  • Development: 1 Cassandra node (appropriate for a development or lab environment)
  • Single Datacenter: 1 datacenter with a minimum of three Cassandra nodes
Important
For more complex Cassandra deployments, please consult with Genesys

Select one of the procedure that matches your deployment scenario.

Development

Configuring Cassandra (1 Cassandra node)

Important
The files modified in this procedure are typically found in the Cassandra_install_dir/conf directory.

Prerequisites

Start

  1. Modify the cassandra.yaml file:
    1. Set seeds to the list of host name of the node. For example: -seeds: “127.0.0.1”
    2. Set listen_address and rpc_address to the host name.
    3. Set data_file_directories, commitlog_directory, and saved_caches_directory to the directories you created in Step 4 of Installing Cassandra.
    4. Set the start_rpc parameter to true.
  2. Save your changes and close the file.

End

Single Datacenter

Configuring Cassandra (1 datacenter)

Complete the steps below for each node.

Important
The files modified in this procedure are typically found in the Cassandra_install_dir/conf directory.

Prerequisites

Start

  1. Modify the cassandra.yaml file:
    1. Set the cluster_name. It must be the same name on all nodes.
    2. Set seeds to the list of host names of all nodes. For example: -seeds: "node1, node2, node3"
    3. Set listen_address and rpc_address to the host name.
    4. Set data_file_directories, commitlog_directory, and saved_caches_directory to the directories you created in Step 4 of Installing Cassandra.
    5. Set the start_rpc parameter to true.
    6. Change endpoint_snitch to PropertyFileSnitch.
  2. Save your changes and close the file.
  3. Open the cassandra-topology.properties file and update for your cluster topology. For each node in your cluster, add the following line:
    [node]=[datacenter]:[rack]

    Where:

    • [node] is the IP address of the node.
    • [datacenter] is the name of the datacenter for this node.
    • [rack] is the name of the rack for this node.

    The following is a sample cassandra-topology.properties file for a Single Datacenter scenario:

    192.0.2.10=datacenter1:rack1
    192.0.2.11=datacenter1:rack1
    192.0.2.12=datacenter1:rack1
  4. Save your changes and close the file.

End

Two Datacenters

Configuring Cassandra (2 datacenters)

Complete the steps below for each node.

Important
The files modified in this procedure are typically found in the Cassandra_install_dir/conf directory.

Prerequisites

Start

  1. Modify the cassandra.yaml file:
    1. Set the cluster_name. It must be the same name on all nodes.
    2. Set seeds to the list of host names of all nodes. For example: -seeds: "node1, node2, node3, node4, node5, node6"
    3. Set listen_address and rpc_address to the host name.
    4. Set data_file_directories, commitlog_directory, and saved_caches_directory to the directories you created in Step 4 of Installing Cassandra.
    5. Set the start_rpc parameter to true.
    6. Change endpoint_snitch to PropertyFileSnitch.
  2. Save your changes and close the file.
  3. Open the cassandra-topology.properties file and update for your cluster topology. For each node in your cluster, add the following line:
    [node]=[datacenter]:[rack]

    Where:

    • [node] is the IP address of the node.
    • [datacenter] is the name of the datacenter for this node.
    • [rack] is the name of the rack for this node.

    The following is a sample cassandra-topology.properties file for a Two Datacenter scenario:

    192.0.2.10=datacenter1:rack1
    192.0.2.11=datacenter1:rack1
    192.0.2.12=datacenter1:rack1
    198.51.100.10=datacenter2:rack1
    198.51.100.11=datacenter2:rack1
    198.51.100.12=datacenter2:rack1
  4. Save your changes and close the file.

End


Verifying the Cassandra2 installation

Prerequisites

Start

  1. Start all Cassandra nodes using the following command: Cassandra_install_dir/bin/cassandra
  2. Use the nodetool utility to verify that all nodes are connected by entering the following command: Cassandra_install_dir/bin/nodetool -h Cassandra_host ring

    The following is sample output for a Single Datacenter scenario with three Cassandra nodes:
    /genesys/apache-cassandra-2.2/bin$ ./nodetool ring
    Address     DC           Rack   Status  State   Load      Owns     Token
    192.0.2.10  datacenter1  rack1  Up      Normal  14.97 MB  100.00%  -9223372036854775808
    192.0.2.11  datacenter1  rack1  Up      Normal  14.97 MB  100.00%  -3074457345618258603
    192.0.2.12  datacenter1  rack1  Up      Normal  14.97 MB  100.00%   3074457345618258602

    The following is sample output for a Development scenario with a single Cassandra node:

    /genesys/apache-cassandra-2.2/bin$ ./nodetool ring
    Address         DC          Rack        Status State   Load            Effective-Ownership Token                                       
    127.0.0.1       datacenter1 rack1       Up     Normal  1.89 MB         100.00%             76880863635469966884037445232169973201

End

This page was last edited on August 12, 2025, at 14:01.
Comments or questions about this documentation? Contact us for support!