简体   繁体   中英

Need to sync data between two tables from different servers Postgresql databases

I have two postgresql databases (prod and stats) running on two different servers. I need to copy records between two tables from these databases. I need to do this 1-2 times a day. It is like a syncing, but after copy data from prod.table1 to stats.table1, i need to update some information in stats.table1 (set additional data in stats.table1 columns and etc.). So, full backup/restore is a bad option for me(my additional data will be lost). I heard about dblink/postgres_fdw, but i don't know how i can tracking my records in prod db.
Maybe i need to develop app for this?

Can you help me with my problem and give me some examples?

You could use logical replication to sync data to stats db. You could have extra columns/table on stats db. Once data is pushed to stats server you could summarize and populate reports on stats db.

check below link to learn more about logical replication.

https://www.enterprisedb.com/postgres-tutorials/logical-replication-postgresql-explained

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM