首页 > 解决方案 > Can't curl the response at port 9200,but can ping directly

问题描述

I have deployed elasticsearch in my remote server at port 9200, and I ran the command:

curl http://localhost:9200

it returns the correct response.

But when I use this command locally:

curl http://xxx.xxx.xxx.xx:9200 (xxx.xxx.xxx.xx is remote server IP), it shows connection failed.

but when I am using the command: ping xxx.xxx.xxx.xx -p 9200,it connects successfully

remote: curl http://localhost:9200 (ok)

local: curl http://xxx.xxx.xxx.xx:9200(failed) ping xxx.xxx.xxx.xx -p 9200 (ok)

标签: elasticsearchelastic-stack

解决方案


确保设置network.host设置为非环回地址。放network.host: 0.0.0.0

https://www.elastic.co/guide/en/elasticsearch/reference/current/network.host.html


推荐阅读