Configuring Clusters in Cassandra

Prerequisite – Monitoring cluster in Cassandra
In this article, we will discuss how we can configure clusters setting in cassandra.yaml file. Also, we will cover some basic parts of cassandra.yaml file in which we can change the by default setting as per our requirements.

Cluster :
In Cassandra, a cluster is a collection of a node. In a cluster, all nodes can communicate through gossip protocol and all nodes have a similar capability in a cluster. A node in the cluster contains keyspaces, tables, schema information, etc.



Cluster Configuration :

  • In Cassandra, cassandra.yaml is the main configuration file in which we can change the default setting as per requirements and after any changes in cassandra.yaml file you must remember to restart the node to take effect.
  • The installation location of the cassandra.yaml file is
    <install_location>/resources/cassandra/conf.




Common properties for Cluster Configuration :
The table below contains the common configurations like cluster name, listen_address, seeds, native transport address, etc.

Name Configuration Setting
cluster_name Default: “Test Cluster”
listen_address Default: localhost
native_transport_address Default: localhost
seeds Default: “127.0.0.1”



cluster_name :
In this configuration, you can change the name of the cluster in cassandra.yaml file. To change the configuration setting follow steps –

  • open cassandra.yaml file.
  • use the command ctrl+f to search in a file.
  • search for cluster_name.
  • You will see the following property in a file cluster_name: ‘Test Cluster’. It is default setting for the cluster node.
  • You can change the cluster name as per your requirements and then press ctrl+s to save the file.

listen_address :
It is the IP address that is used by other nodes in a cluster to find out this node. To change the configuration setting follow steps –

  • open cassandra.yaml file.
  • use the command ctrl+f to search in a file.
  • Search for listen_address.
  • You will see the following property in a file listen_address: localhost. It is default setting for the cluster node.
  • You can change the IP listen_address as per your requirements and then press ctrl+s to save the file.

native_transport_address :
It is an IP address that is used by the client to connect with the node or the cluster. To change the configuration setting follow steps –

  • open cassandra.yaml file.
  • use the command ctrl+f to search in a file.
  • Search for native_transport.
  • You will see the following property in a file native_transport_address: localhost. It is default setting for the cluster node.
  • You can change the IP native_transport as per your requirements and then press ctrl+s to save the file.

seed address or seed addresses :
It is used when a new node joined the cluster. In general, all nodes in a cluster have the same seed list. To change the configuration setting follow steps –

  • open cassandra.yaml file.
  • use the command ctrl+f to search in a file.
  • Search for seeds.
  • You will see the following property in file seeds: “127.0.0.1”. It is default setting for the cluster node.
  • You can change the seeds IP address as per your requirements and then press ctrl+s to save the file.

Output –

seed_provider :
# Addresses of hosts that are deemed contact points.
# Cassandra nodes use this list of hosts to find each other and learn
# the topology of the ring. You must change this if you are running
# multiple nodes!

class_name : org.apache.cassandra.locator.SimpleSeedProvider

parameters :
# seeds is actually a comma-delimited list of addresses.
# Example - "<ip1>, <ip2>, <ip3>"

seeds : "127.0.0.1"



Example of Cluster Configuration :

Setting Node 1 Node 2 Node 3
IP address (External) 192.168.10.71 192.168.10.72 192.168.10.73
cluster_name DC1 DC1 DC1
listen_address 192.168.10.71 192.168.10.72 192.168.10.73
native_transport_address 192.168.10.71 192.168.10.72 192.168.10.73
seeds “192.168.10.71” “192.168.10.72” “192.168.10.73”

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.