16

Starting from version 2.0 Elasticsearch binds only on the loopback interface by default (_local_ in terms of configuration).

The documentation says that there is a way to switch to another network, for example, _non_loopback_ binds to the first non-loopback interface. It works fine.

But I cannot figure out how do I combine these settings so that Elasticsearch binds on both loopback and non-loopback interfaces simultaneously?

PS. My reason is that I use Logstash on each Elasticsearch instance that connects to it via localhost, but I also want other Elasticsearch instances to see each other to form the cluster...

Funbit
  • 1,591
  • 2
  • 14
  • 15
  • This might be doable using [transport profiles](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-transport.html#_tcp_transport_profiles) but I haven't tried yet. – Val Oct 29 '15 at 11:13
  • @Val, thank you for the suggestion, but according to the reference transport profiles are only for node-to-node communication... Of course, I can still use non-localhost IP address for Logstash configuration, but it would make configuration maintenance much worse than it is used to be in 1.x. – Funbit Oct 30 '15 at 03:25
  • @Funbit how do you connect LS to ES? – Andrei Stefan Oct 30 '15 at 08:44
  • @AndreiStefan Using this: hosts => ["127.0.0.1:9200"] . As I said, I could include ethernet IP here, but I would have to do that for each instance separately.. since Logstash does not support environment/dynamic variables in its configuration. – Funbit Oct 30 '15 at 09:24
  • @Funbit what protocol are you using with LS? Assuming `http` (since port 9200) – Andrei Stefan Oct 30 '15 at 09:32
  • @AndreiStefan Not sure how it is related to the problem, but: I'm using "tcp" input, and "elasticsearch" output. LS 2.0 (which I'm trying to use with ES 2.0) supports only "http" protocol. – Funbit Oct 30 '15 at 09:55
  • Ok. Then try in your ES something like the following. Remove any `network.bind*` and `network.publish*` settings from your `elasticsearch.yml` file and add `transport.host: _non_loopback_` and `http.host: _local_`. – Andrei Stefan Oct 30 '15 at 09:59
  • @AndreiStefan This way I will lose ability to connect to ES instances from Kibana or Browsers... I dont want to install reverse proxy just for that.. – Funbit Oct 30 '15 at 10:55
  • Try another config and see how it goes: `network.bind_host: 0` – Andrei Stefan Oct 30 '15 at 14:01
  • @AndreiStefan The magic worked! Thank you! Please post an answer I'll mark it as the right one. – Funbit Oct 30 '15 at 14:28

3 Answers3

40

For 2.0 you would need to use

network.bind_host: 0
Andrei Stefan
  • 51,654
  • 6
  • 98
  • 89
8

As of ElasticSearch 7.x, this configuration has changed yet again. for a simple single node cluster bound to loopback, local and external IPs, you essentially do this:

network.host: [_local_, _site_, _global_]
cluster.initial_master_nodes: node-1

The cluster node setting is explained here while the network host setting is in the documentation here, although it doesn't say how you would assign multiple values to network.host.

Dexter Legaspi
  • 3,192
  • 1
  • 35
  • 26
2

Go to

'<path_to_elasticsearch>/elasticsearch-2.3.4/config'

Open elasticsearch.yml

Add network.host: 0.0.0.0

Now check which port elasticsearch is using (9200 is default), go to firewall inbound rules and add those ports.

ketankk
  • 2,578
  • 1
  • 29
  • 27