[英]FOSElasticaBundle for Symfony2. How to configure to connect to a cluster?
我正在通过FOSElasticaBundle在系统中使用Elasticsearch和Symfony2。
当我仅使用一台服务器时,可以像这样配置clients
配置: https : //github.com/FriendsOfSymfony/FOSElasticaBundle#basic-configuration
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
但是,当涉及到集群时,我尝试以某种方式进行配置,但它无法正常工作,如下所示:
fos_elastica:
clients:
default: [{host: localhost, port: 9200},{host: localhost, port: 9201}]
和这个:
fos_elastica:
clients:
default:
- { host: localhost, port: 9200 }
- { host: localhost, port: 9201 }
我知道FOSElasticaBundle使用Elastica库 ,并且该库使用参数数组连接到群集,因此我在上面尝试了这些方法。
有谁知道如何连接以配置FOSElasticaBundle连接到某个集群?
提前致谢。
您实际上并不需要列出所有节点,因为ElasticSearch 确实会对集群进行负载均衡。 但是,仍然可以这样做(例如,如果您连接的节点脱机)。 请记住,这只是简单的循环。
这是您的操作方式:
fos_elastica:
clients:
default:
servers:
- { host: localhost, port: 9200 }
- { host: localhost, port: 9201 }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.