9

I've install ES on my VM which it has an OS of centos 7. It network.host: bind to the localhost. I can browse via port 9200.

My problem is that I've changed the network host to:0.0.0.0 (So I can get public access from my host PC).
the service started but the port is not listening.

I want to access ES from my host PC.
How can i change the network.host ?

Green
  • 2,405
  • 3
  • 22
  • 46
vish
  • 671
  • 2
  • 7
  • 15
  • Use netstat -ntlp to check open ports. Check the ES logs – Manish R Oct 13 '18 at 17:53
  • Take a loot at this https://stackoverflow.com/questions/34449342/installed-elastic-search-on-server-but-cannot-connect-to-it-if-from-another-mach/34461159?noredirect=1#comment77157976_34461159. – Manish R Oct 14 '18 at 03:31
  • @ManishR I've tried but that won't success. Port is not listening for this, network.bind_host: 0 http.cors.allow-origin: "*" http.cors.enabled: true – vish Oct 14 '18 at 16:07

5 Answers5

32

I faced same issue in elasticsearch 7.3.0 version. I resolved by putting following

values in /etc/elasticsearch/elasticsearch.yaml as shown below

network.host: 127.0.0.1
http.host: 0.0.0.0
Shree Prakash
  • 2,052
  • 2
  • 22
  • 33
  • 2
    Windows users you may find the config doesn't updates don't work. I discovered an environment variable in ES_CONFIG which pointed to application data. Updating that config file with these details worked. – Luke Oct 14 '19 at 02:35
6

If you are planning to set network.host other than default(127.0.0.1) then change following details in /etc/elasticsearch/elasticsearch.yml

  • network.host: 0.0.0.0
  • discovery.seed_hosts: []
c.sankhala
  • 850
  • 13
  • 27
  • 1
    I tried a bunch of different ways from Internet to force Elastic listen on 0.0.0.0 and only this one helped me. Thank you very much! – Anton Jun 04 '20 at 07:30
  • 1
    Same here, wasn't working without the discover.seed_hosts line. Thanks! – Luke Belbina Feb 10 '21 at 18:58
5

Looking at the Elasticsearch Network Settings documentation, it doesn't appear that 0.0.0.0 is a valid setting for network.host.

Try instead the special value _global_. So the section of your elasticsearch.yaml might look like this:

network:
  host: _global_

This should tell Elasticsearch to listen on all network interfaces.

orangejulius
  • 989
  • 1
  • 10
  • 23
  • I've changed then service failed to start. Again changed to localhost then works fine. What i want to do is sent logs to ES using Logstash installed on another server. ES ruining on another server. – vish Oct 17 '18 at 06:14
  • Issue resolved after following below instructions. After IP change Memory lock not working on ES. https://stackoverflow.com/questions/45008355/elasticsearch-process-memory-locking-failed – vish Oct 17 '18 at 09:24
1

Since the version 7.3 of Elastic Search, it's necessary to put the following line

cluster.initial_master_nodes: node-1
network.host: 0.0.0.0
1

If your application is running on AWS and Elastic search is running on different host

network.host: YOUR_AWS_PRIVATE_IP

This works for me.