elasticsearch - 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)
解决方案
确保设置network.host
设置为非环回地址。放network.host: 0.0.0.0
https://www.elastic.co/guide/en/elasticsearch/reference/current/network.host.html
推荐阅读
- javascript - 是否可以从 JavaScript 中的 if 语句的主体将新字符串附加到 if 语句之外的变量?
- google-cloud-platform - 从谷歌云扳手数据库部署数据
- r - 如何通过使用 R 选择正确的输入从网站下载数据(查询不会更改 URL)
- python - 键入并选择条目时过滤列表
- android - 用 onclick 监听器替换列表视图不起作用
- php - 如何按名称获取数据 Codeigniter
- gradle - 更新 Gradle 6 的 XText 版本时出错
- firefox - web-ext:如何在暗模式下运行 Firefox?
- python - Python 脚本正确执行每条语句,但也返回 ModuleNotFoundError
- python-3.x - pygame 键盘记录器改进的想法?