ES not listening to external requests

﹥>﹥吖頭↗ 提交于 2020-01-02 23:03:46

问题


I have an e2 ubuntu instance running elasticsearch, and although it works fine locally, I can't connect from a windows pc using curl http://ipaddress:9200/ (error is "unable to connect to the remote server").

I've set up Apache on the same ubuntu instance and curl http://ipaddress:80/ works from the same windows machine, & I can ping the instance with no trouble. My amazon security group allows tcp access to all ports from all IP addresses.

I think it's an ES config issue, although the only lines I've added to elasticsearch.yml are:

http.cors.enabled: true
http.cors.allow-origin: "*"

I've noticed something strange when I run netstat, there's a 1 in the Local address for ports 9200 and 9300 (ES ports) - would this block my external request, and if so how do I change this?

   ubuntu@ESServer$ netstat -nat
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0    448 (AWS PRIVATE IP):22     (MY IP):63572           ESTABLISHED
tcp6       0      0 :::22                   :::*                    LISTEN
tcp6       0      0 ::1:9200                :::*                    LISTEN
tcp6       0      0 127.0.0.1:9200          :::*                    LISTEN
tcp6       0      0 :::80                   :::*                    LISTEN
tcp6       0      0 ::1:9300                :::*                    LISTEN
tcp6       0      0 127.0.0.1:9300          :::*                    LISTEN

回答1:


It seems that your elasticsearch process is bind to localhost. Try to run it like this:

bin/elasticsearch --network.host _non_loopback_

Since 2.0 elasticsearch binds to localhost. For that reason you are not able to access it.

The reasons behind this change is explained in this blog post



来源:https://stackoverflow.com/questions/34480618/es-not-listening-to-external-requests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!