简体   繁体   English

Rails:searchkick gem和Amazon EC2实例,Faraday :: ConnectionFailed

[英]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.reindexrails 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_

Relevant docs 相关文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 带有 ElasticSearch 的 Searchkick 返回“Faraday::ConnectionFailed: execution expired” - Searchkick with ElasticSearch returns "Faraday::ConnectionFailed: execution expired" EC2实例移动时执行Rails“无论何时”的gem - Executing Rails 'whenever' gem when EC2 Instance Moves 如何在Rails中的Amazon EC2实例上运行长时间运行的作业? - How to run a long running job on Amazon EC2 instance in Rails? Ruby on Rails + Thin + Nginx的Amazon EC2实例 - Amazon EC2 instance for Ruby on Rails + Thin + Nginx 我可以安全地使用Amazon的Elasticsearch和Rails searchkick gem吗? - Can I use Amazon's Elasticsearch with Rails searchkick gem securely? 为什么elasticserach-rails突然提升Faraday :: ConnectionFailed(执行过期)? - Why is elasticserach-rails suddenly raising Faraday::ConnectionFailed (execution expired)? Faraday::ConnectionFailed 使用 docker 在 rails 中使用弹性搜索时失败 - Faraday::ConnectionFailed when using elastic search in rails using docker 法拉第的Rspec :: ConnectionFailed - Rspec for Faraday::ConnectionFailed 安装rails后,如何在amazon ec2实例上运行rails服务器? - After installing rails, how to run rails server on amazon ec2 instance? 如何将Rails应用程序部署到Amazon EC2 - How to deploy rails application to amazon EC2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM