# Java client usage in the presence of split-brain

**URL:** <https://discuss.elastic.co/t/java-client-usage-in-the-presence-of-split-brain/16419>\
**Category:** Elasticsearch\
**Created:** [March 18, 2014, 9:04am UTC](https://discuss.elastic.co/t/java-client-usage-in-the-presence-of-split-brain/16419 "2014-03-18T09:04:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![magnus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnus/32/1732_2.png) [@magnus](https://discuss.elastic.co/u/magnus)\
**Post date:** [March 18, 2014, 9:04am UTC](https://discuss.elastic.co/t/java-client-usage-in-the-presence-of-split-brain/16419/1 "2014-03-18T09:04:30Z")

</div>

Hi,

Given that I have a cluster with 4 nodes, currently experiencing a  
split-brain scenario so I have a fully functional cluster with 3 green  
nodes, a sick cluster with 1 red node.  
A java-client that talks to these 4 nodes (unicast zen discovery) will ~25%  
of the time query the sick node, and get an error back. I'd expect it to  
retry one of the healthy nodes, not just give up after an erroneous reply.

Do I need to handle this myself, or is this something the java client  
should handle for me? I know there's some sort of retry logic in the  
transport layer..

ES 0.90.7.

--  
Magnus Haug

--  
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 [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/5dca4946-c26f-42f3-98ac-53bc2b478fc3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/5dca4946-c26f-42f3-98ac-53bc2b478fc3%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [March 18, 2014, 11:45am UTC](https://discuss.elastic.co/t/java-client-usage-in-the-presence-of-split-brain/16419/2 "2014-03-18T11:45:34Z")

</div>

You have in all case do anything to prevent split brains, by setting  
minimum master nodes, at least to 3.

Regarding the Java client, you can use the TransportClient with better  
control of what nodes you want to connect to, but that will not solve your  
problems. With minimum master node 3, you could attach the TransportClient  
to these 3 master eligible nodes. More, you could use "sniff mode" where  
every 5 secs the client can add/remove data nodes automatically. But, a  
TransportClient can not detect split brains, so in most circumstances, you  
will mess your data. Also, the retry logic is not related to cover split  
brain issues.

Jörg

On Tue, Mar 18, 2014 at 10:04 AM, [magnus@stack.no](mailto:magnus@stack.no) wrote:

> Hi,
> 
> Given that I have a cluster with 4 nodes, currently experiencing a  
> split-brain scenario so I have a fully functional cluster with 3 green  
> nodes, a sick cluster with 1 red node.  
> A java-client that talks to these 4 nodes (unicast zen discovery) will  
> ~25% of the time query the sick node, and get an error back. I'd expect it  
> to retry one of the healthy nodes, not just give up after an erroneous  
> reply.
> 
> Do I need to handle this myself, or is this something the java client  
> should handle for me? I know there's some sort of retry logic in the  
> transport layer..
> 
> ES 0.90.7.
> 
> --  
> Magnus Haug
> 
> --  
> 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 [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/5dca4946-c26f-42f3-98ac-53bc2b478fc3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/5dca4946-c26f-42f3-98ac-53bc2b478fc3%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/5dca4946-c26f-42f3-98ac-53bc2b478fc3%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/5dca4946-c26f-42f3-98ac-53bc2b478fc3%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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 [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAKdsXoE185cSMnT\_k3BJFTFNGrAmrxkpApwkSCRiym2%2BhUbXXQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoE185cSMnT_k3BJFTFNGrAmrxkpApwkSCRiym2%2BhUbXXQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:42am UTC](https://discuss.elastic.co/t/java-client-usage-in-the-presence-of-split-brain/16419/3 "2017-07-06T01:42:33Z")

</div>


