Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elasticsearch cannot start when bind to public ip address

if i leave the network.host commented out in /etc/elasticsearch/elasticsearch.yml, it will start like normal (curl localhost:9200 returns result as expected).

However, if I set network.host = <public-ip> then sudo service elasticsearch restart it will says OK but then the status of elasticsearch is not running.

what did I do wrong in this case?

System: Ubuntu 14.04 LTS

Update: Fixed by binding it to 0.0.0.0.

like image 584
Tuan Anh Tran Avatar asked Nov 18 '15 02:11

Tuan Anh Tran


2 Answers

Update: Fixed by binding it to 0.0.0.0.

like image 158
Tuan Anh Tran Avatar answered Nov 15 '22 07:11

Tuan Anh Tran


The proper way to fix this is to pass the bootstrap tests in elasticsearch:

add to /etc/security/limits.conf something like:

# elasticsearch
*               hard    nofile          65536
*               hard    nproc           2048

Be careful with the network configuration!
Never expose an unprotected node to the public internet. (elasticsearch docs)

A secure solution would be to bind to a loopback interface & create an ssh tunnel from the host that needs access => elasticsearch

like image 29
Stuart Cardall Avatar answered Nov 15 '22 06:11

Stuart Cardall