nikel
nikel

Reputation: 3564

why do we need to setup a publish address[network.host] value

Looks like elastic search is not discoverable without setting the box's ip address in this property : network.host .

Why cant it just bind to the box's ip address(like it happens in application servers like rest apps). Why is there even a provision to bind to a particular ip address?

Upvotes: 0

Views: 2402

Answers (3)

pedrosk
pedrosk

Reputation: 5

To run on a local network a single node I added these to my un-comment or comment elasticsearch.yml

http.port: 9201
http.bind_host: 192.168.1.172 #works

or

http.port: 9201
http.publish_host: 192.168.1.172 #by itself does not work
http.host: 192.168.1.172 #works alone

Upvotes: 0

Jilles van Gurp
Jilles van Gurp

Reputation: 8314

The key property that matters is network.publish_host. You configure this indirectly via network.host. The publish host is the address that nodes advertise to other nodes as the address to be reached on when they join the cluster. So, it needs to be something that is reachable from the other nodes. E.g. 127.0.0.1 would not work for this; likewise a loadbalanced address won't work either.

Also see documentation for these properties

Many servers have multiple network interfaces and a common problem before this change was Elasticsearch picking the wrong one for the publish host and then failing to cluster because the nodes ended up advertising the wrong address to each other. Since Elasticsearch cannot know the right interface, you have to tell it.

Upvotes: 1

Val
Val

Reputation: 217474

This change has been introduced in 2.0 as explained in the breaking changes > network changes documentation:

This change prevents Elasticsearch from trying to connect to other nodes on your network unless you specifically tell it to do so. When moving to production you should configure the network.host parameter

The ES folks also released a blog article back then to explain the underlying reasons for this change, i.e. mainly to prevent your node from accidentally binding to another cluster available on the network.

Upvotes: 1

Related Questions