简体   繁体   中英

Postgresql - Logical Replication maintenance

In our organization, we are running Postgres 14.5. There is requirement from our team to enable logical replication for few tables. Current WAL_Level is "Replica".

Now, I need change this to "logical" to enable logical replication. My doubt is, if the WAL_Level is changed to "logical", do I need to do any regular maintenance post the change. I am asking this doubt from SQL server perspective. In SQL Server, when the recovery model of database is changed to "Full", we have to run the transactional log backup at regular interval, otherwise the log file will keep growing. Same way, do we need to run any task to keep the size the database under control.

Note: Please let me know, are there any other maintenances that I need to do perform regarding this change.

No, you don't need any additional maintenance (that you aren't already doing), except that you have to restart PostgreSQL for the new setting to take effect.

The only effect of wal_level = logical is, that more information is stored inside each WAL segment.

However, you need to monitor the replication and the corresponding replication slot to identify the situation where replication breaks, and the primary piles up WAL segments because the replica doesn't fetch them any more.

You might want to configure max_slot_wal_keep_size to avoid that the primary runs out of disk space if the replication fails for some reason and your monitoring doesn't alert you.

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