marcv81
marcv81

Reputation: 876

How to configure the interface Cassandra listens on?

I am trying to set up a test Cassandra 3.3 cluster on Ubuntu 15.10 with OpenJDK 1.8. The nodes can't talk to each other because Cassandra only listens on the loopback interface, as netstat shows.

tcp        0      0 127.0.0.1:7199          0.0.0.0:*               LISTEN     
tcp6       0      0 127.0.0.1:9042          :::*                    LISTEN

I have tried to insert my external IP address in /etc/cassandra/cassandra.yml.

I also tried modifying the following in /etc/cassandra/cassandra-env.sh.

JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=<actual external IP address>"

Between each change I stop the service, delete /var/lib/cassandra/data/system, and restart the service.

How does one configure the interface Cassandra listens to?

Upvotes: 3

Views: 5658

Answers (1)

Aaron
Aaron

Reputation: 57748

rpc_address is the address that external app clients will use to connect with Cassandra.

listen_address is the address that Cassandra will use to connect to other Cassandra nodes.

I would make sure that your nodes can communicate on that IP. Specifically, Cassandra will use port 7000 for inter-node communication (7001 if using node-to-node SSL). The best way to test this is with telnet. If it works, this is what you will see:

$ telnet 192.168.0.101 7000
Trying 192.168.0.101...
Connected to 192.168.0.101.
Escape character is '^]'.

So I would:

  1. Figure out whether or not the nodes can communicate with each other on port 7000.
  2. If they can, set the IPs that they see each other as in each cassandra.yaml's listen_address.
  3. You'll probably also want to pick one of those as a seed node.

Upvotes: 4

Related Questions