What address should I use for listen_address in cassandra.yaml?

I am trying to create a database with several cassandra data on two different machines. How do I configure the cassandra.yaml file? The datastax documentation says

listen_address¶ (Default: localhost) The IP address or host name that other Cassandra nodes use to connect to this node. If left inactive, the host name should be resolved 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 works fine on the local computer, and when I use my IP address, it cannot connect. Why is that?

+8
cassandra
source share
1 answer

Configuring nodes and seed nodes in Cassandra is fairly simple, but certain steps must be followed. The procedure for setting up a multi node cluster is well documented , and I will quote from a related document.

I think it’s easier to illustrate the configuration of nodes with 4 instead of 2, since 2 nodes do not make sense to run an instance of Cassandra. If you had 4 nodes divided into 2 machines and 1 seed node on each machine, the conceptual configuration would look like this:

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 for all nodes.

If the nodes in the cluster are identical in terms of disk layout, shared libraries, etc., you can use the same copy of the cassandra.yaml file for all of them

You will need to set the IP address under the -seeds configuration in cassandra.yaml.

-seeds: the internal IP address of each node seed

  parameters: - seeds: "86.82.155.1,192.82.156.1" 

It is important to understand the difference between a node and a seed node. If you go through these IP addresses, you may encounter problems similar to what you are describing, and from your comment it turned out that you have adjusted the configuration.

Seed nodes are not loading, this is the process of a new node connecting an existing cluster. For new clusters, the bootstrap process on seed nodes is skipped.

If you are having trouble capturing the node architecture, read the Architecture briefly or see Understanding the Core Concepts Class .

+4
source share

All Articles