Docker cluster on 3 nodes

Hi all, I have seen similiar question, but for the better of me I cant get it to work.

I am trying to setup a cluster on three different docker machines (different servers) the setup looks similiar to this

docker run --rm -d \
      --name=crate01  \
      -v cratevol1:/data \
      -p 4200:4200 \
      -p 4300:4300 \
      -p 5432:5432 \
      --add-host=crate01=192.168.1.11 \
      --add-host=crate02=192.168.1.12 \
      --add-host=crate03=192.168.1.13 \
      --cpus 2 \
      --memory 8g \
      --network host \
      --env CRATE_HEAP_SIZE=4g \
      --pull=always \
      crate \
      crate -Cnetwork.host=_site_ \
            -Cnode.name=crate01 \
            -Cdiscovery.seed_hosts=crate02,crate03 \
            -Ccluster.initial_master_nodes=crate01,crate02 \
            -Cgateway.expected_data_nodes=3 \
            -Cgateway.recover_after_data_nodes=3 

on all hosts. Now every node starts but they dont connect, I am pretty sure the issue lies here

[2024-11-04T15:52:07,433][WARN ][o.e.d.HandshakingTransportAddressConnector] [crate01] [connectToRemoteMasterNode[192.168.1.12:4300]] completed handshake with [{crate02}{ZVtAhPScQXi2HDfsQdDO-Q}{gxdTEWQnQ6-nmOxAhorbNA}{172.17.0.1}{172.17.0.1:4300}{dm}{http_address=172.17.0.1:4200}] but followup connection failed
org.elasticsearch.transport.ConnectTransportException: [crate02][172.17.0.1:4300] handshake failed. unexpected remote node {crate01}{Nhsq4gWrQ-mLLcehgkt73g}{8W4SHgqHQP2ojrQZQk0N8g}{172.17.0.1}{172.17.0.1:4300}{dm}{http_address=172.17.0.1:4200}

So, they find the other node, but for some strange reasons they try to connect to the docker internal ip (172.17.0.1) afterwards. As these are all different docker servers they basically find themselfs and get an issue.

I tried different things but running out of ideas. Any hint or helo would be appreciated.

Thanks in advance
Joerg

1 Like

Okay, so it is actually easy to fix

-Cnetwork.host=192.168.1.11

sets the publish and communication address, as I use "host"as network this works actually

1 Like