I'm using Elasticsearch and Symfony2 in a system via FOSElasticaBundle.
While I was using only one server it was ok to configure the clients
config like this:
https://github.com/FriendsOfSymfony/FOSElasticaBundle#basic-configuration
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
But when it comes to a cluster, I've tried to configure in some ways but it does not work, like this:
fos_elastica:
clients:
default: [{host: localhost, port: 9200},{host: localhost, port: 9201}]
And this:
fos_elastica:
clients:
default:
- { host: localhost, port: 9200 }
- { host: localhost, port: 9201 }
I know that FOSElasticaBundle uses the Elastica library, and that library connects to clusters using arrays of parameters, that is why I have tried those approaches above.
Does anyone know how to connect to configure FOSElasticaBundle to connect to some cluster?
Thanks in advance.
you don't really need to list all your nodes, as ElasticSearch does load balance the cluster. However, it's still possible to do (e.g. in case the node you connect to goes offline). Keep in mind that it's just simple round robin though.
This is how you do it:
fos_elastica:
clients:
default:
servers:
- { host: localhost, port: 9200 }
- { host: localhost, port: 9201 }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With