Postgresql – Database replication from local Postgres to live

data synchronizationpostgresqlreplication

I have a software whose data from its local Postgres server has to be synced to live database, so that I can query data from that live Postgres server via api. I am new to Postgres. So after a small research I came across Database replication concept such as hot standby, streamed replication, wal files, background processes etc.

My question is whether it is possible to replicate my local Postgres database to live Postgres database and also access or query the live Postgres database for CRUD operations and also I want both the databases to be in sync irrespective of the database on which the CRUD operations are being performed.

Found similar questions already answered.

  1. How to PUSH data between a Local DB Server to Cloud DB Server?
  2. Streaming replication Postgresql 9.3 using two different servers (can we write on the copy database?)

Best Answer

What you seem to be asking for is multi-master replication, and there is no built-in or open source solution for that. There are a couple of closed source solutions.

You should consider changing your requirements. Multi-master replication is conceptually difficult, and you usually end up with fewer headaches if you choose a different architecture.