Quantcast
Channel: StackExchange Replication Questions
Viewing all articles
Browse latest Browse all 17268

Replication of PostgreSQL cluster from Datacenter to Office with write access

$
0
0

Some information about the cluster:

Version: postgres 9.5

Size: /postgres/data$ du -hs . 854G

OS: Ubuntu 14.04 LTS

Storage: Raid10 SSD's

I have a master-slave PostgreSQL 9.5 cluster running in a datacenter using standard postgres replication features (streaming replication and wal-shipping). My goal is to build a second "slave" server in our office to be able to reproduce bugs that occured in production. As postgres hot-standby slaves only support readonly queries, my approach would be to nightly recreate the slave and start it stand-alone with write access. The data from last night would be sufficient for 95% of the support tickets and I am fully aware that all changes to these databases made during the day would be lost.. ;)

As the cluster is quite large, I'm not sure what would be the best way to implement this.

I'm thinking about a cronjob running nightly on the office slave:

  1. master_datacenter: pg_start_backup

  2. rsync postgres data directory from slave_live_datacenter to slave_lastnight_office

  3. master_center: pg_stop_backup();

  4. rsync wal files from slave_live_datacenter to slave_lastnight_office

  5. start slave_lastnight_office (in live writable mode, not slave/recovery mode)

Would it be possible to skip the rsync part and only update slave_lastnight_office to the state of last night with the newer wal and pitr? I guess not, as the changes during the day would make the replaying of the new wal impossible?


Viewing all articles
Browse latest Browse all 17268

Trending Articles