question

XXSD avatar image
XXSD asked Erick Ramirez edited

Nodes in Docker cannot communicate with each other

I have a nodejs web server and a cassandra node deployed in one machine with ip address: 192.168.2.68 using docker. The docker-compose file with the web server and cassandra node (node1) is here: https://pastebin.com/ngDL16LQ

The web server works fine and can insert data into the cassandra server. However I am trying to connect a second node to the cluster in a machine with ip address: 192.168.2.36 and I keep getting errors and exit code 3. The docker compose file for this node (node2) is here: https://pastebin.com/GFY8Jq23

The node1 logs can be found here: https://pastebin.com/Nimz5vXV

The node2 logs can be found here: https://pastebin.com/TUij36rZ

I can ping both machine1 from machine2 and vice-versa. From what I can see it can establish connection but it fails right after. Also the ips differ:

cassandra_node1 | INFO [Messaging-EventLoop-3-7] 2021-12-09 17:57:13,220 InboundConnectionInitiator.java:464 - /172.20.0.2:7000(/192.168.2.36:35844)->/172.29.0.2:7000-URGENT_MESSAGES-ab3a76b9 messaging connection established, version = 12, framing = LZ4, encryption = unencrypted
cassandra_node1 | INFO [Messaging-EventLoop-3-4] 2021-12-09 17:57:42,714 NoSpamLogger.java:92 - /172.29.0.2:7000->/172.20.0.2:7000-URGENT_MESSAGES-[no-channel] failed to connect
dockernetwork
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered

This isn't a Cassandra issue but a networking issue.

You need to make sure that:

  1. there is network connectivity between nodes,
  2. there is network connectivity between the app/client and the nodes
  3. all the ports on the nodes are accessible.

Cheers!

Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.