简体   繁体   English

在另一个Rails应用程序中使用一个Rails应用程序的Elasticsearch服务器

[英]Use one elasticsearch server of rails application in another rails application

My rails application is running using four ec2 instances. 我的Rails应用程序正在使用四个ec2实例运行。 When user hit rails application using url, rails application will be serve to the user using any one of four ec2 instance using ELB. 当用户使用url访问Rails应用程序时,Rails应用程序将使用ELB的四个ec2实例中的任何一个提供给用户。

Elasticsearch server is installed on one of the rails server. Elasticsearch服务器安装在其中一个rails服务器上。 How i can use same elasticsearch server which is installed on one server for rest of three rails servers also for searching? 我如何才能将安装在一台服务器上的同一Elasticsearch服务器用于其余三个Rails服务器的其余部分来进行搜索?

I am using the internal (10.xxx) address for connecting to elasticsearch. 我正在使用内部(10.xxx)地址连接到elasticsearch。

Elasticsearch::Model.client = Elasticsearch::Client.new(host:'10.xxx',port:9200)

As long as you set your inbound rules right you can connect to your elasticsearch instance from any ec2 host. 只要您正确设置入站规则,就可以从任何ec2主机连接到您的elasticsearch实例。

Make sure that elasticsearch listens on 10.xxx and not only on 127.0.0.1. 确保elasticsearch在10.xxx上侦听,而不仅在127.0.0.1上侦听。

put network.host: _site_ in elasticsearch.yml network.host: _site_elasticsearch.yml

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM