AI Insights
January 25, 2025

How to configure Datastax cluster on VMs

Learn the configuration of Datastax DSE database cluster on your own machine VMs.

D

DataMy Team

DataMy Team

Following up on previous blog post about single cassandra/Datastax DSE node setup, here's how we created a two-node cluster. Please replace all IPs with your acutal local IPs.

What we are Working With: Two Datastax DSE (Cassandra) nodes running on Ubuntu 24.10 VMs DSE installed under 'home/user/node1 folder' and 'home/user/node2' for two nodes

Here's the step-by-step:

  1. First, Stop Everything Stop Cassandra on both nodes:
$ node1/bin/nodetool stopdaemon
  1. Clean Slate Remove old data from both nodes:
sudo rm -rf /var/lib/cassandra/*
  1. The Important Part - cassandra.yaml Config 🔑 Find your cassandra.yaml file (mine was at 'node1/resources/cassandra/conf/cassandra.yaml') Here's what you need to change: A. Set the same cluster name on both nodes
cluster_name: 'YourClusterName'

B. Seed Provider Setup (this is crucial!)

yamlCopy- class_name: org.apache.cassandra.locator.SimpleSeedProvider
  parameters:
      - seeds: "192.168.47.128"    # Use Node 1's IP here

!Pro tip: Make sure Node 2 also points to Node 1's IP in its seeds config!

C. Network Settings For Node 1:

listen_address:
rpc_address: 192.168.47.128192.168.47.128

For Node 2:

listen_address:
rpc_address: 192.168.47.129192.168.47.129
  1. Open Firewall Ports
$ sudo iptables -A INPUT -p tcp --dport 7000 -j ACCEPT
$ sudo iptables -A INPUT -p tcp --dport 9042 -j ACCEPT
  1. Fire It Up!
$ sudo systemctl start cassandra (Cassandra)
$ node1/bin/dse cassandra (Datastax DSE)
  1. Check If It Worked After starting both nodes, check if they are communicating properly by running command on either node:
$ bin/nodetool status

You should see something like this:

Datacenter: Cassandra
=====================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving/Stopped
--  Address         Load       Tokens       Owns (effective)  Host ID                               Rack
UN  192.168.47.128  123.59 KiB  1            100.0%            2f3f874e-74d1-435d-b124-61f249f54d97  rack1
UN  192.168.47.129  204.15 KiB  1            100.0%            76b05689-845c-43e5-9606-50a06d68df14  rack1

Bonus: You can further prove which partition resides on which node by executing the following nodetool commands in the terminal from either node:

$ node/bin/nodetool getendpoints keyspacename tablename 'partition_key_value

That's it! If you run into any issues or have questions,Contact DataMy. Happy testing! 🚀

Tags:
DatabaseDatastaxCassandra