Create a Cassandra cluster
Create a Cluster with a Single Seed Node
-
Launch the Bitnami Cassandra Stack on each node.
-
Log in to each node and stop the Cassandra service.
$ sudo /opt/bitnami/ctlscript.sh stop cassandra
-
Get the public and private IP address of each node in the cluster.
-
Select one of the nodes as the seed node for the cluster. In this guide, assume that the seed node has public IP address 130.1.1.1 and private IP address 10.1.1.1.
-
Open the Cassandra transport port (tcp:7000 by default) in your server firewall. Then, restart your Cassandra servers.
-
On each node in the cluster, modify the /opt/bitnami/cassandra/conf/cassandra.yaml file and update the following directives:
-
-seeds: Use the public IP address of the seed node.
-
listen_address: Use the current node’s private IP address.
-
broadcast_address: Use the current node’s public IP address.
-
endpoint_snitch: Select the correct snitch for your environment based on the official documentation.
For example, on the seed node, your configuration file might look like this:
cluster_name: 'MyCassandraCluster' num_tokens: 256 seed_provider: - class_name: org.apache.cassandra.locator.SimpleSeedProvider parameters: - seeds: "130.1.1.1" broadcast_address: 130.1.1.1 listen_address: 10.1.1.1 endpoint_snitch: GossipingPropertyFileSnitch
Repeat the above configuration for all the nodes in the cluster. Remember that you must modify the listen_address and broadcast_address on each node to reflect the node’s IP addresses.
-
-
For all nodes apart from the seed node, delete the default data. This is necessary to avoid collisions between the system tables on different nodes.
$ sudo rm -rf /opt/bitnami/cassandra/data/*
-
Start Cassandra on the seed node, followed by the other nodes, to have the changes take effect:
$ sudo /opt/bitnami/ctlscript.sh start cassandra
Your cluster should now be operational with a single seed node. To verify, execute the command below on any node in the cluster:
$ /opt/bitnami/cassandra/bin/nodetool status
You can connect to any server of the cluster using the credentials for the first seed node.
You can also watch the Cassandra log file at /opt/bitnami/cassandra/log/system.log to check that the cluster nodes recognize and can communicate with each other.
Create a Cluster with Multiple Seed Nodes
IMPORTANT: Before creating a cluster with multiple seed nodes, ensure that you have a working cluster with a single seed node as described in the previous section. Then, repeat the steps below for each new seed node that you wish to add to the cluster.
-
Launch the Bitnami Cassandra Stack on a new node. This will be the new seed node for your cluster.
-
Log in to each node and stop the Cassandra service.
$ sudo /opt/bitnami/ctlscript.sh stop cassandra
-
Get the public and private IP address of the new seed node. In this guide, assume that the new seed node has public IP address 140.1.1.1 and private IP address 20.1.1.1.
-
On the new node, edit the configuration file /opt/bitnami/cassandra/conf/cassandra.yaml and specify it as a seed node by adding its public IP address to the seeds list. Also specify the other configuration parameters, such as the listen_address and the broadcast_address, as described in the previous section. Here is what the configuration file would look like:
cluster_name: 'MyCassandraCluster' num_tokens: 256 seed_provider: - class_name: org.apache.cassandra.locator.SimpleSeedProvider parameters: - seeds: "130.1.1.1, 140.1.1.1" broadcast_address: 140.1.1.1 listen_address: 20.1.1.1 endpoint_snitch: GossipingPropertyFileSnitch
-
Delete the default data. This is necessary to avoid collisions between the system tables on different nodes.
$ sudo rm -rf /opt/bitnami/cassandra/data/*
-
On each of the other nodes in the cluster, update the /opt/bitnami/cassandra/conf/cassandra.yaml file and add the public IP address of the new seed node to the seeds list.
-
Restart Cassandra on the seed nodes, followed by the non-seed nodes.
$ sudo /opt/bitnami/ctlscript.sh start cassandra
Your cluster should now be operational with the new seed node. To verify, execute the command below on any node in the cluster:
$ /opt/bitnami/cassandra/bin/nodetool status
You can connect to any server of the cluster using the credentials for the first seed node.
You can also watch the Cassandra log file at /opt/bitnami/cassandra/log/system.log to check that the cluster nodes recognize and can communicate with each other.