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

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


The two nodes connects , elects a master properly and runs @

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

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.