0
votes

My Question is as follows,

If I have a Master / Slave infrastructure in postgres and use streaming replication (hot standby) and I wish to replicate my data from my master to my slave and decide to delete rows in my master postgres server, will those changes also take place on my slave postgres server ?, if so, How am I able to prevent that, I wish to replicate my sql data using WAL segments to my slave as somewhat of an archive server.

The reason for this is due to my master server not having adequate amounts of storage and getting more storage capacity is not an option, furthermore, All data should be stored on the slave. So again, is this possible with replication streaming?

I do not wish to move to another replication strategy as I have invested too many hours into the project and cannot go back on that decision and start some new form of replication.

Your input is greatly appreciated.

1
the idea of streaming replication was to roll over WAL to slaves. no escape. - Vao Tsun

1 Answers

0
votes

No.

What you want is not replication. You want some form of archiving. A trigger-based system would be the simplest to adapt, possibly a logical WAL-based stream could do the trick too. The precise nature of the system required will depend on the precise structure, usage and contents of your database. Do you have one main table you want to manage, do you need to track modifications, do you have custom functions that can modify tables etc.

If there is a single large table (event log or similar) you may be able to do something with table partitioning by date and periodically dumping and restoring the oldest partition before dropping it on the master.

Take the time to understand your requirements before starting again, and I'm afraid you will just have to write off the time invested in your first approach.