无法在EC2实例中通过公共IP访问我的Elasticsearch [英] Can't access my elasticsearch through public IP in EC2 instance

查看:165
本文介绍了无法在EC2实例中通过公共IP访问我的Elasticsearch的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在EC2实例上部署了elasticsearch(7.3版)服务。

I have deployed elasticsearch(7.3 version) service on my EC2 instance.


  • 安装后,我做了
    curl localhost:9200 我的响应正确,但是当我通过点击请求访问同一服务时: http:// {{public-ip-address-ec2-instance}}:9200

  • After installing when I did curl localhost:9200it gave me correct response but when I accessed the same service by hitting request:http://{{public-ip-address-ec2-instance}}:9200

错误提示为:

无法访问此网站:{{public-ip-address-ec2-instance}}连接被拒绝。


  • 我已经配置了EC2的安全组通过允许将自定义TCP上的入站流量设置为实例,该自定义TCP设置为默认的弹性搜索端口 9200 ,并打开为 0.0.0.0/0

  • I have configured security group of EC2 instance by allowing inbound traffic on custom TCP which is set to default elastic search port 9200 and is open to 0.0.0.0/0.

当前我还没有修改 elasticsearch.yml

所以如何通过EC2实例的公共IP访问Elasticsearch?
我需要吗在Elasticsearch配置文件中进行任何更改?

推荐答案

因此解决方案只是在 elasticsearch.yml 中修改以下设置:

So the solution was simply to modify the following settings in elasticsearch.yml:

network.host: 0.0.0.0
discovery.type: single-node

注意:仅当您有一个节点时,才需要第二个设置。

Note: The second setting is only necessary if you have a single node.

这篇关于无法在EC2实例中通过公共IP访问我的Elasticsearch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆