Elasticsearch isn't working with host IP

I am setting up Elasticsearch but it only seems to work with local host. When I go into elasticsearch.yml I uncomment out only network.host & http.port as the tutorial states. It works when I leave network.host as "localhost" & http.port with 9200. However when I change network.host to 192.168.1.15 (Which is the host machines IP address) it doesn't work... Has anyone else had this problem?

Could you be more specific? What does not work ?

Additionally what are the logs?

Haha, I guess I could have been more descriptive. When I run the commands :
service elasticsearch start & service elasticsearch status it says elasticsearch is running and there are no issues for atleast 30 seconds... After that the service stops and this is the output from the logs from when the service starts & ends :

https://pastebin.com/pvKBBk9Q

However, when I go to 192.168.1.15:9200 in the browser I am getting a Unable to connect response.

The only edits I have made in /etc/elasticsearch/elasticsearch.yml is uncommenting out network.host to enter the IP of the host & uncommenting http.port.

I don't receive the unable to connect error message if I leave network.host as "localhost"

There is a message here:

org.elasticsearch.transport.BindTransportException: Failed to bind to [9300-9400]

So it can not bind 192.168.1.15 to your node. Is this ip really the right one that you can see on the machine where elasticsearch is running?
I mean that it seems you are running under VirtualBox (judging by the name). Is 192.168.1.15 the external IP address or the internal one?

192.168.1.15 is the IP address of the VirtualBox machine I have installed elasticsearch on.

Is there any way around this error so elasticsearch connects to the VM?

What is the IP address of the network card inside the vm?

my laptop IP is 192.168.1.2 my VM ip is 192.168.1.15

You can bind your ip by simply setting
network.host: 0.0.0.0
It binds everything for HTTP and transport.
in ElasticSearch.yml

Would I connect to 0.0.0.0:9200 on the browser then? I am still receiving the same error in logs.

1 Like

No, then you can use your machine ip address.
Type ipconfig on the command line and copy your ipv4 address.
http://[your_ipv4_address]:9200

I am still receiving the same error message in logs, & when I run the command service elasticsearch status it shows the service failed.

elasticsearch.service : Main process exited, code=exited, status=78/n/a

elasticsearch.service : Failed with result 'exit-code'

I was able to connect to it through localhost 127.0.0.1 however I am not able to connect to elasticsearch on my host machine (not the VM)

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.