CrateDB cluster using docker doesn't form

Hello,

I’m trying to build a CrateDB cluster using docker and the host type network, to use the subnet where the three host machines are connected.

I use these commands, each on a single host:
host1
docker run -d --name crate1 --net=host --env CRATE_HEAP_SIZE=2g --env CRATE_CLUSTER_NAME=my_cluster --env CRATE_DISCOVERY_SEEDS=10.0.0.2,10.0.0.3 crate

host2
docker run -d --name crate2 --net=host --env CRATE_HEAP_SIZE=2g --env CRATE_CLUSTER_NAME=my_cluster --env CRATE_DISCOVERY_SEEDS=10.0.0.1,10.0.0.3 crate

host3
docker run -d --name crate3 --net=host --env CRATE_HEAP_SIZE=2g --env CRATE_CLUSTER_NAME=my_cluster --env CRATE_DISCOVERY_SEEDS=10.0.0.1,10.0.0.2 crate

I’m trying to build a CrateDB cluster using docker and the host type network, to use the subnet where the three host machines are connected.

I use these commands, each on a single host, three instances of cratedb are created but all as master and no cluster is formed.

Do you have a suggestion of how to create the cluster in this way (docker with --net host)?

Thank you.

Luca

1 Like

Hi,
You would need to change your commands into something like:

docker run -d --name crate1 --net=host --env CRATE_HEAP_SIZE=2g crate -Ccluster.name=my_cluster -Cdiscovery.seed_hosts=10.0.0.2,10.0.0.3 -Ccluster.initial_master_nodes=10.0.0.1,10.0.0.2,10.0.0.3

docker run -d --name crate2 --net=host --env CRATE_HEAP_SIZE=2g crate -Ccluster.name=my_cluster -Cdiscovery.seed_hosts=10.0.0.1,10.0.0.3 -Ccluster.initial_master_nodes=10.0.0.1,10.0.0.2,10.0.0.3

docker run -d --name crate3 --net=host --env CRATE_HEAP_SIZE=2g crate -Ccluster.name=my_cluster -Cdiscovery.seed_hosts=10.0.0.1,10.0.0.2 -Ccluster.initial_master_nodes=10.0.0.1,10.0.0.2,10.0.0.3

Please note that for security reasons you should configure your network so that the CrateDB cluster nodes are only reachable on port 4300 from other CrateDB nodes in the cluster.

2 Likes

Hi hernanc, thank you, your answer solved the situation.

The cluster is formed.

Now I’ve two critical error ,

The value of the cluster setting 'gateway.expected_data_nodes' (or the deprecated gateway.recovery_after_nodes setting)must be equal to the maximum/expected number of (data) nodes in the cluster. https://cr8.is/d-node-check-1

The value of the cluster setting 'gateway.recover_after_data_nodes' (or the deprecated gateway.recovery_after_nodes setting)needs to be greater than half of the maximum/expected number of (data) nodes and equal or less than the maximum/expected number of (data) nodes in the cluster. https://cr8.is/d-node-check-2

Is it correct to set

gateway.expected_data_nodes = 3
gateway.recover_after_data_nodes = 2

with these values ?

Thx.

Luca

1 Like

Hi,
Glad that it worked.
With those settings you mention the warnings should disappear, but there are implications to configure recover_after_data_nodes to a value lower than expected_data_nodes.
In 5.4 we are improving the wording around those warnings and the documentation, you can read more about what these mean in the updated documentation which you can reach at this link System information — CrateDB: Reference

1 Like

Hi,
What’s your suggestion for a correct setting of the cluster ?

Thx,
Luca