Re: master/master replication with load balancer in front

From: Martín Marqués <martin(at)2ndquadrant(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: master/master replication with load balancer in front
Date: 2015-08-30 22:06:07
Message-ID: 55E37E4F.9090207@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

El 24/08/15 a las 15:41, Florin Andrei escribió:
> On 2015-08-23 06:56, Martín Marqués wrote:
>> El 21/08/15 a las 20:45, Florin Andrei escribió:
>>>
>>> The single instance scheme is not very reliable. I need to build a new
>>> DB backend. I'll set up Postgres 9.4. Ideally, I'd like to setup 2
>>> instances, each instance placed in a different availability zone.
>>> Master/master replication. I'll put a load balancer (ELB) in front of
>>> both instances.
>>
>> It's not clear if the main goal is reliability (or availability), or to
>> balance writes.
>>
>> If you are looking for HA, single master with multiple standbys is your
>> best bet (you can put standbys on different zones).
>
> This is for reliability / availability.
>
> The thing is, if I have a single master and an AZ fails, I still have to
> make manual changes to switch to the healthy AZ - and, until then,
> updates would fail. Master/master, in theory, should absorb single-AZ
> failures without needing any manual intervention.

When updates fail the application should have the code to retry
executing those statements or return the appropriate errors to the user
so further actions can be carried on.

And in any case, you will need to adjust you application or pooling
system to send statements to a node that's up. Multi-master solutions
won't magically do that.

Maybe you should take a look at repmgr and particularly the automatic
failover feature:

https://github.com/2ndQuadrant/repmgr/blob/master/FAILOVER.rst

>> You can also look at BDR and have masters geographically distributed,
>> but I'd strongly suggest you look at the link
>> http://bdr-project.org/docs/stable/weak-coupled-multimaster.html, and
>> keep in mind that with multi-master systems you will be more prone to
>> data modification conflicts.
>
> I get the sense that BDR is not 100% ready for prime time. Is that
> accurate?

BDR is ready for prime time, but if it will work for you depends on your
needs. BDR aims at *eventually* consistent multi-masters system with
geographically distributed nodes, so DML statements on one node will not
be slowed down because the data has to be replicated to other distant nodes.

There's still lots of ground where to improve, but isn't that also true
for any other system?

The important thing is if it provides what you need.

I suggest you run some tests and see if it fits your requirements.

Regards,

--
Martín Marqués http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martín Marqués 2015-08-31 00:25:13 Re: BDR setup - bdr_node_join_wait_for_ready()
Previous Message Martín Marqués 2015-08-30 21:11:43 Re: AIX 7.1 compile and initdb startup error TRAP: FailedAssertion