Can't get a two-node cluster to work

Hi,

So, I installed oss-7.9 on two VMs with RH8.
All I want is a cluster with two nodes, of which one acts as a replica.

I have the same config on both VMs, though of course with different IPs and node names, differences are shown in brackets:

 cluster.name: "cluster-3"
 node.name: "node-1" ["node-2"]
 network.host: 10.0.2.39 [10.0.2.32]
 http.port: 9200
 transport.host: 10.0.2.39
 transport.port: 9300
 node.master: true
 node.data: true
 discovery.zen.ping.unicast.hosts: ["10.0.2.32:9300","10.0.2.39:9300"]
 discovery.zen.minimum_master_nodes: 2

But looking at the cluster state on either of the machines, it never shows two nodes.
I don't think that any important port is blocked. I can even use curl from one machine to look at the state on the other.

Any suggestions?

(Please don't tell me that the oss version does not support this :slight_smile: )

Thanks.

The OSS version does indeed support this (but the default distribution is recommended for a large number of other reasons).

The discovery.zen.* settings are obsolete in this version and should be removed. Instead, configure things following the instructions on this page. You'll probably have to wipe the data path of both nodes too since they've likely formed independent clusters which cannot now be merged together.

Hope that's not the same on both nodes - best to not set transport.host at all, so it'll just use your network.host setting, which (in my opinion) should be set to 0.0.0.0 for simplicity and consistency across nodes.

Thanks, I will give it a try.
if I restart the elasticsearch service, or stop and start it manually, how do I prevent them from forming their own node and instead wait to see if there is another one?

Thanks, I removed it.

It is working! Thanks.

Though it's weird, I'm pretty sure I tried this configuration already, using discovery.seed.. and not using transport.host...
But I never deleted the data path ...

This is covered in these docs, but the TLDR is that setting discovery.seed_hosts disables auto-bootstrapping.

Also see the NOTE at the bottom of that page which says if you did accidentally auto-bootstrap then you should wipe the nodes and start again.

Steve's right too, you only need transport.host if you have a strange setup involving listening on multiple interfaces. Almost always you want to set network.host only. Also no need to set http.port or transport.port, nor to mention :9300 in the seed hosts, nor to set the node roles. IOW this is all you need:

 cluster.name: "cluster-3"
 node.name: "node-1" # [resp. "node-2"]
 network.host: "10.0.2.39" #  [resp. "10.0.2.32"]
 discovery.seed_hosts: ["10.0.2.32","10.0.2.39"]

(also cluster.initial_master_nodes: ["node-1","node-2"], but only the first time you run them)

1 Like

Hi again.

One more thing: This is still working and is nice. Node 2 automatically gets the same messages as node 1.

But I noticed, that if I disconnect node 2, for some reason, I can reload kibana on node 2, but on node 1 I get a timeout, and rsyslog messages are not saved in elasticsearch ...

Is there an option to have node 1 still receive messages and node 2 to just resync after it is online again?

I remember seeing a minimum master nodes option, but I think this was for zen, which is not supposed to be used anymore.

For high availability you need a minimum of 3 nodes.

1 Like