[英]Rails: searchkick gem and amazon ec2 instance, Faraday::ConnectionFailed
I have created a amazon ec2 instance and successfully logged into the instance via ssh
. 我创建了一个Amazon ec2实例,并通过
ssh
成功登录到该实例。 And now I'm trying to to reindex a model from rails c
with Model.reindex
, but I'm getting the following error: 现在,我尝试使用
Model.reindex
从rails c
重新为模型建立索引,但是出现以下错误:
Faraday::ConnectionFailed: Failed to open TCP connection to localhost:9200 (Connection refused - connect(2) for "localhost" port 9200)
I have added all the tcp ports(80,22,5432,433,9200,9300) to the appropriate security groups. 我已将所有tcp端口(80、22、5432、433、9200、9300)添加到适当的安全组。
Also I have edited the /etc/elasticsearch/elasticsearch.yml
file with following information: 我还用以下信息编辑了
/etc/elasticsearch/elasticsearch.yml
文件:
cluster.name: esonaws
bootstrap.mlockall: true
network.host: xxx.xx.xx.xx(this is the instance private ip)
http.port: 9200
discovery.zen.ping.unicast.hosts: xxx.xx.xx.xx(this is the instance private ip)
and then did a sudo service elasticsearch restart
, the elasticsearch starts ok, but when I try to reindex again the same error pops up again. 然后
sudo service elasticsearch restart
,elasticsearch开始正常,但是当我再次尝试重新索引时,再次弹出相同的错误。
btw when I do this inside the ssh
curl localhost:9200/_cluster/health?pretty
I get this: 顺便说一句,当我在
ssh
curl localhost:9200/_cluster/health?pretty
执行此操作时,我得到了:
curl: (7) Failed to connect to localhost port 9200: Connection refused
but if I use the private ip of the amazon ec2 instanceit works and returns all the cluster information. 但是,如果我使用amazon ec2实例的私有IP,它将正常工作并返回所有群集信息。
curl http://xxx.xx.xx.xx:9200/_cluster/health?pretty^C
Any ideas what I might be missing here and how to get this to work? 有什么想法我可能在这里缺少以及如何使它起作用吗?
Elasticsearch binds to network.host
, so if you want to use localhost
instead of the private ip, you need to use network.host: _local_
. Elasticsearch绑定到
network.host
,因此,如果您要使用localhost
而不是私有ip,则需要使用network.host: _local_
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.