Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multi master replication in postgresql [closed]

Tags:

postgresql

Can someone guide me to do multi-master replication with PostgreSQL.

I have done master-slave replication but how do I get master-master replication.

I have tried to use pg-pool-II but I couldn't find any good documentation for it.

Let me know what can I do to achieve master-master replication in PostgreSQL. thanks.

like image 548
n j Avatar asked Oct 29 '13 11:10

n j


People also ask

Does Postgres support multi-master?

PostgreSQL has built-in single-master replication, but unfortunately, there is no multiple-master replication in mainline PostgreSQL. There are some Multimaster replication solutions available, some of these are in the form applications and some are PostgreSQL forks.

How does multi-master replication work?

Multi-Master Replication is where data replication is done in such a way that data is replicated to a group of computers known as master systems and anyone can update database and update done by anyone is replicated to other systems as well. Here all members deal with client equally as writes can be done by any system.

How many types of replication are there in PostgreSQL?

In PostgreSQL, there are two types of replication features: streaming replication (physical replication) that collectively replicates a database cluster, and logical replication that replicates in units of tables and databases.

What is the best multi-master replication solution for PostgreSQL?

There is one popular product commercially available at the moment that supports multi-master replication in PostgreSQL. It is called Bidirectional replication created by 2ndQuadrant. The earlier versions of BDR were open-source, but not the latest ones.

Do I need multi-master replication for high-availability?

You don't need multi-master for high-availability. @a_horse_with_no_name If my master server fails I want my replicated master to finish the job since I cannot grant the standby server that privilege. There is no free (or open source) master-master replication solution for current Postgres versions.

Does PostgreSQL support unidirectional replication?

Replication is the crucial pillar of horizontal scalability, and PostgreSQL supports unidirectional master-slave replication, which is enough for many use-cases. Database replication replicates the data on other servers and stores it on more than one node.

What happens when the primary server fails in PostgreSQL?

When the primary server fails, it is not necessary to wait for a physical standby to be promoted. It is recommended that PostgreSQL users not complicate the design by going for multi-master replication where single-master replication is enough. This is because multi-master replication makes the system complicated and messy.


2 Answers

It's very difficult to make real multi-master replication on PostgreSQL. There was no good solutions. May be you don't really need master-master replication and there is a room for vertical scaling (better disk system, more CPUs, more memory).

But if you want to do this I'd recommend to have a look at PostgreSQL-XC, looks like it's stable now.

like image 168
alexius Avatar answered Oct 16 '22 12:10

alexius


As far as I know you need a third party solution like Bucardo to perform a multi master replication in PostgreSQL.

Take a look at this tutorial for an example of configuring Bucardo and PostgreSQL for a multi master replication.

like image 11
aleroot Avatar answered Oct 16 '22 12:10

aleroot