I am trying to set up a multinode cassandra database on two different machines. How am i supposed to configure the cassandra.yaml file? The datastax documentation says
listen_address¶ (Default: localhost ) The IP address or hostname that other Cassandra nodes use to connect to this node. If left unset, the hostname must resolve to the IP address of this node using /etc/hostname, /etc/hosts , or DNS. Do not specify 0.0.0.0.
When i use 'localhost' as the value of listen_address, it runs fine on the local machine , and when i use my ip address, it fails to connect. Why so?
Configuring the nodes and seed nodes is fairly simple in Cassandra but certain steps must be followed. The procedure for setting up a multi node cluster is well documented and I will quote from the linked document.
I think it is easier to illustrate the set up of nodes with 4 instead of 2 since 2 nodes would make little sense to a running Cassandra instance. If you had 4 nodes split between 2 machines and 1 seed node on each machine the conceptual configuration would appear as follows:
node1 86.82.155.1 (seed 1)
node2 86.82.155.2
node3 192.82.156.1 (seed 2)
node4 192.82.156.2
If each of these machines is the same in terms of layout you can use the same cassandra.yaml file across all nodes.
If the nodes in the cluster are identical in terms of disk layout, shared libraries, and so on, you can use the same copy of the cassandra.yaml file on all of them
You will need to set the IP address up under the -seeds
configuration in cassandra.yaml.
-seeds: internal IP address of each seed node
parameters:
- seeds: "86.82.155.1,192.82.156.1"
Understanding the difference between a node and seed node is important. If you get these IP addresses crossed you may experience issues similar to what you are describing and from your comment it appears you have corrected the configuration.
Seed nodes do not bootstrap, which is the process of a new node joining an existing cluster. For new clusters, the bootstrap process on seed nodes is skipped.
If you are having trouble grasping the node based architecture read the Achitecture in Brief document or watch the Understanding Core Concepts class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With