Solution: After debugging the the elasticsearch php client I found a retry
mechansim that allows the client to jump to the next server from the pool
if the previous is down.
**this mechanism is disabled by default**
to enable this mechanism you need to initialize the Client with a parameter
called retries:
$params = array();
$params['hosts'] = $ELSEARCH_SERVER;
$params['retries'] = count($ELSEARCH_SERVER);
$dstEl = new Elasticsearch\Client($params);
Hope it will help you guys
On Monday, August 18, 2014 2:52:31 PM UTC+3, Niv Penso wrote:
>
> I followed this link to create an elasticsearch 2 nodes cluster on Azure:
> this
> link <http://thomasardal.com/running-elasticsearch-in-a-cluster-on-azure/>
>
> the installation and configuring went good.
>
> When i started to check the cluster i found a strange behaviour from the
> php client.
>
> I declared 2 hosts in the client:
>
> $ELSEARCH_SERVER = array("dns1:9200","dns2:9200");
> $params = array();
> $params['hosts'] = $ELSEARCH_SERVER;
> $dstEl = new Elasticsearch\Client($params);
>
> the excpected behaviour is that it will try to insert the documents to
> "dns1" and if it fails it will *automatically* change to "dns2". but, for
> some reason when one of the servers is down on insertion the php client
> throws an exception that it couldn't connect to host and only.
>
> Is there any way to cause the client automatically choose an online server?
>
> thnx, Niv
>
--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/73467675-14c2-497d-8934-67b31e5b6295%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.