"Static IP:port" for the master of the cluster

Hi,
Hope I'm not insane, I have run two nodes in the same server.
This is my conf,

network.host: 10.111.99.20
_network.bind_host: 0.0.0.0
_network.publish_host: 10.111.99.20

The two nodes connects , elects a master properly and runs @10.111.99.20:9200.

The problem is when first one is down, the second becomes the master, but it's IP becomes 10.111.99.20:9201

Can a cluster always have a "static" IP to the outside world ?

You can not have two sockets bound to the same port on the same interface, ever.

This means that if one node binds to 9200 on an interface, the other must bind to a different port if using the same interface. By default, Elasticsearch will try to bind to 9201 if 9200 is not available.

By configuring your clients properly, this should never be an issue though. You should specify that one node binds to 9200, the other binds to 9201 and configure your clients to look for nodes on both 9200 and 9201.

Thanks @jasontedor for your answer.