Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to bind Elasticsearch 2.0 on both Loopback and Non-Loopback interfaces?

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...

like image 233
Funbit Avatar asked Oct 29 '15 11:10

Funbit


3 Answers

For 2.0 you would need to use

network.bind_host: 0
like image 124
Andrei Stefan Avatar answered Nov 16 '22 08:11

Andrei Stefan


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.

like image 38
Dexter Legaspi Avatar answered Nov 16 '22 09:11

Dexter Legaspi


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.

like image 2
ketankk Avatar answered Nov 16 '22 10:11

ketankk