# What is the behaviour of connection failure between masters in multi-master setup?

**URL:** <https://forum.yugabyte.com/t/what-is-the-behaviour-of-connection-failure-between-masters-in-multi-master-setup/774>\
**Category:** General\
**Created:** [July 19, 2020, 2:32pm UTC](https://forum.yugabyte.com/t/what-is-the-behaviour-of-connection-failure-between-masters-in-multi-master-setup/774 "2020-07-19T14:32:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![guydewinton](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/guydewinton/32/240_2.png) [@guydewinton](https://forum.yugabyte.com/u/guydewinton)\
**Post date:** [July 19, 2020, 2:32pm UTC](https://forum.yugabyte.com/t/what-is-the-behaviour-of-connection-failure-between-masters-in-multi-master-setup/774/1 "2020-07-19T14:32:33Z")

</div>

Hello

Forgive the naivity of these questions. I am quite new to developing distributed systems.

I am building a small distributed system for a small business with two servers, one local and one in the cloud (so that if local environment loses internet connection the client can still access local and if local fails the client can still access cloud). Both environments should be able to operate without the other.

If the local environment loses internet, there will be two functioning but disconnected servers. What would Yugabyte’s behaviour be in this instance? Will it create two independent clusters? When the connection is restored do they recluster? How could the data resynced? What if a record has been updated in both places?

I hope all of this makes sense. I may we’ll be way of the field in my understanding of these things. Any help appreciated!

Thanks.

---

<div class="post-metadata">

**Author:** ![dorian\_yugabyte](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/dorian_yugabyte/32/206_2.png) [@dorian\_yugabyte](https://forum.yugabyte.com/u/dorian_yugabyte)\
**Post date:** [July 20, 2020, 7:57am UTC](https://forum.yugabyte.com/t/what-is-the-behaviour-of-connection-failure-between-masters-in-multi-master-setup/774/2 "2020-07-20T07:57:46Z")

</div>

Hi @guydewinton

Welcome to YugabyteDB Forum!

You need an odd number of servers and we recommend a minimum of 3 in a cluster. See replication docs: [Deploy | YugabyteDB Docs](https://docs.yugabyte.com/latest/deploy/checklist/#replication).

In this case, the 2 remaining servers will continue serving reads + writes.

Regards,  
Dorian  
Technical Support Engineer

---

<div class="post-metadata">

**Author:** ![dorian\_yugabyte](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/dorian_yugabyte/32/206_2.png) [@dorian\_yugabyte](https://forum.yugabyte.com/u/dorian_yugabyte)\
**Post date:** [July 20, 2020, 9:30am UTC](https://forum.yugabyte.com/t/what-is-the-behaviour-of-connection-failure-between-masters-in-multi-master-setup/774/3 "2020-07-20T09:30:39Z")

</div>

Another way is to use [2DC asynchronous](https://docs.yugabyte.com/latest/deploy/multi-dc/2dc-deployment/) replication. In case of conflicts, the last write wins.

---

<div class="post-metadata">

**Author:** ![guydewinton](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/guydewinton/32/240_2.png) [@guydewinton](https://forum.yugabyte.com/u/guydewinton)\
**Post date:** [July 20, 2020, 6:57pm UTC](https://forum.yugabyte.com/t/what-is-the-behaviour-of-connection-failure-between-masters-in-multi-master-setup/774/4 "2020-07-20T18:57:32Z")

</div>

Thank you for your reply. I have begun a deep dive into your docs as well as getting to know the RAFT consensus algorithm and Kubernetes. It is starting to make sense. I must say that I am blown away by the amount of intelligence that has gone into all of these technologies.

I have a few more questions that have been percolating on the way…

1. If I have a three or five node cluster and one node goes down or there is a network partition, how would the remaining 2 or 4 nodes handle an additional failure (there now being an even number)?

2. Can the client connect to any node which will forward the requests to the cluster master? If, for instance, the webserver shares a machine with a node, does it just connect to localhost?

3. I am using Django to handle the requests. Can I just use my existing Postgres driver (same setup - just changing port and default username)?

4. Could I make the nodes (2) on the local network read/write and have the cloud node read only so that if there is a network partition the local cluster will continue to function fully while the cloud will continue to serve reads? In this case is there some communication it could offer the client to let it know it is now read only?

I hope it is ok to dump these disparate questions here.

Many thanks.

---

<div class="post-metadata">

**Author:** ![dorian\_yugabyte](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/dorian_yugabyte/32/206_2.png) [@dorian\_yugabyte](https://forum.yugabyte.com/u/dorian_yugabyte)\
**Post date:** [July 21, 2020, 9:03am UTC](https://forum.yugabyte.com/t/what-is-the-behaviour-of-connection-failure-between-masters-in-multi-master-setup/774/5 "2020-07-21T09:03:08Z")

</div>

> [@guydewinton](#):
>
> If I have a three or five node cluster and one node goes down or there is a network partition, how would the remaining 2 or 4 nodes handle an additional failure (there now being an even number)?

Please see how replication works in [Deploy | YugabyteDB Docs](https://docs.yugabyte.com/latest/deploy/checklist/#replication).

More generally, if RF is `n` , YugabyteDB can survive `(n - 1) / 2` failures without compromising correctness or availability of data.

> [@guydewinton](#):
>
> Can the client connect to any node which will forward the requests to the cluster master? If, for instance, the webserver shares a machine with a node, does it just connect to localhost?

You can connect to any host. And the requests are always routed.

> [@guydewinton](#):
>
> I am using Django to handle the requests. Can I just use my existing Postgres driver (same setup - just changing port and default username)?

Yes. Please use version 2.2 which includes support for [deferred constraints](https://docs.yugabyte.com/latest/api/ysql/commands/ddl_create_table/#deferrable-constraints) that are required by django.

> [@guydewinton](#):
>
> Could I make the nodes (2) on the local network read/write and have the cloud node read only so that if there is a network partition the local cluster will continue to function fully while the cloud will continue to serve reads? In this case is there some communication it could offer the client to let it know it is now read only?

This will work. We advise to have 3 regions in this case. Whatever region you lose, you will still be able to write data to the cluster. Is there a problem you can’t use 3 regions ?

You can also [set preferred zones](https://docs.yugabyte.com/latest/admin/yb-admin/#set-preferred-zones) to the localhost node(s) if that’s your primary write node.

> [@guydewinton](#):
>
> I hope it is ok to dump these disparate questions here.

It’s ok!

---

<div class="post-metadata">

**Author:** ![guydewinton](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/guydewinton/32/240_2.png) [@guydewinton](https://forum.yugabyte.com/u/guydewinton)\
**Post date:** [July 26, 2020, 2:06pm UTC](https://forum.yugabyte.com/t/what-is-the-behaviour-of-connection-failure-between-masters-in-multi-master-setup/774/6 "2020-07-26T14:06:10Z")

</div>

Amazing. Thank you. Really useful and interesting. A lot to be getting on with!
