Thread: [GENERAL] Streaming Replication archive_command is really needed?
Hi, I wonder if archive_mode=on and archive_command parameters in postgresql.conf are really needed for streaming replication between two servers (master-slave). Regards, -- Leonardo M. Ramé Medical IT - Griensu S.A. Av. Colón 636 - Piso 8 Of. A X5000EPT -- Córdoba Tel.: +54(351)4246924 +54(351)4247788 +54(351)4247979 int. 19 Cel.: +54 9 (011) 40871877
On 20 July 2017 21:46:09 GMT+02:00, "Leonardo M. Ramé" <l.rame@griensu.com> wrote: >Hi, I wonder if archive_mode=on and archive_command parameters in >postgresql.conf are really needed for streaming replication between two > >servers (master-slave). > >Regards, No. Andreas -- 2ndQuadrant - The PostgreSQL Support Company
El 20/07/17 a las 16:57, Andreas Kretschmer escribió: > On 20 July 2017 21:46:09 GMT+02:00, "Leonardo M. Ramé" <l.rame@griensu.com> wrote: >> Hi, I wonder if archive_mode=on and archive_command parameters in >> postgresql.conf are really needed for streaming replication between two >> >> servers (master-slave). >> >> Regards, > > No. > > Andreas > So, can I just comment those commands and remove the main/archive directory? -- Leonardo M. Ramé Medical IT - Griensu S.A. Av. Colón 636 - Piso 8 Of. A X5000EPT -- Córdoba Tel.: +54(351)4246924 +54(351)4247788 +54(351)4247979 int. 19 Cel.: +54 9 (011) 40871877
On 20/07/2017 23:07, Leonardo M. Ramé wrote: > > > El 20/07/17 a las 16:57, Andreas Kretschmer escribió: >> On 20 July 2017 21:46:09 GMT+02:00, "Leonardo M. Ramé" <l.rame@griensu.com> wrote: >>> Hi, I wonder if archive_mode=on and archive_command parameters in >>> postgresql.conf are really needed for streaming replication between two >>> >>> servers (master-slave). >>> >>> Regards, >> >> No. >> >> Andreas >> > > So, can I just comment those commands and remove the main/archive directory? You'll lose the capability of PITR. Also what do you mean main/archive directory? I hope you don't mean data/pg_xlog . -- Achilleas Mantzios IT DEV Lead IT DEPT Dynacom Tankers Mgmt
On Thu, Jul 20, 2017 at 10:07 PM, Leonardo M. Ramé <l.rame@griensu.com> wrote: > El 20/07/17 a las 16:57, Andreas Kretschmer escribió: >> On 20 July 2017 21:46:09 GMT+02:00, "Leonardo M. Ramé" >> <l.rame@griensu.com> wrote: >>> >>> Hi, I wonder if archive_mode=on and archive_command parameters in >>> postgresql.conf are really needed for streaming replication between two >>> >>> servers (master-slave). >> >> No. > > So, can I just comment those commands and remove the main/archive directory? "No" is not completely exact and lacks in details. There are two cases where having an archive is helpful: 1) The standby has disconnected from its primary for a time long enough that WAL segments have been rotated by two completed checkpoints. If that happens, when the standby reconnects it would fail, and you would need to take a new base backup. 2) Backup strategies. Keeping a larger history set of WAL segments is helpful for incremental backups, which is partially the point actually raised upthread about PITR. -- Michael
Am 21.07.2017 um 08:01 schrieb Michael Paquier: > On Thu, Jul 20, 2017 at 10:07 PM, Leonardo M. Ramé <l.rame@griensu.com> wrote: >> El 20/07/17 a las 16:57, Andreas Kretschmer escribió: >>> On 20 July 2017 21:46:09 GMT+02:00, "Leonardo M. Ramé" >>> <l.rame@griensu.com> wrote: >>>> Hi, I wonder if archive_mode=on and archive_command parameters in >>>> postgresql.conf are really needed for streaming replication between two >>>> >>>> servers (master-slave). >>> No. >> So, can I just comment those commands and remove the main/archive directory? > "No" is not completely exact and lacks in details. There are two cases > where having an archive is helpful: > 1) The standby has disconnected from its primary for a time long > enough that WAL segments have been rotated by two completed > checkpoints. If that happens, when the standby reconnects it would > fail, and you would need to take a new base backup. you can prevent that using replication slots, but i'm pretty sure you (Michael) knows that ;-) ( http://paquier.xyz/postgresql-2/postgres-9-4-feature-highlight-replication-phydical-slots/ ) > 2) Backup strategies. Keeping a larger history set of WAL segments is > helpful for incremental backups, which is partially the point actually > raised upthread about PITR. Ack, that's right. Using both (streaming and wal-shipping/archiving) will make it more robust, and you have (with archiving) the posibility for PITR. BUT, you can build a streaming replication without archiving, even you can build a continuous backup using only streaming (Barman, streaming only mode). Regards, Andreas -- 2ndQuadrant - The PostgreSQL Support Company. www.2ndQuadrant.com
On Fri, Jul 21, 2017 at 8:15 AM, Andreas Kretschmer <andreas@a-kretschmer.de> wrote: > Am 21.07.2017 um 08:01 schrieb Michael Paquier: >> "No" is not completely exact and lacks in details. There are two cases >> where having an archive is helpful: >> 1) The standby has disconnected from its primary for a time long >> enough that WAL segments have been rotated by two completed >> checkpoints. If that happens, when the standby reconnects it would >> fail, and you would need to take a new base backup. > > you can prevent that using replication slots, but i'm pretty sure you > (Michael) knows that ;-) > http://paquier.xyz/postgresql-2/postgres-9-4-feature-highlight-replication-phydical-slots/ There is a typo on my URL here. Well that's too late to fix it even if that's bad style. >> 2) Backup strategies. Keeping a larger history set of WAL segments is >> helpful for incremental backups, which is partially the point actually >> raised upthread about PITR. > > Ack, that's right. Using both (streaming and wal-shipping/archiving) will > make it more robust, and you have (with archiving) the posibility for PITR. > BUT, you can build a streaming replication without archiving, even you can > build a continuous backup using only streaming (Barman, streaming only > mode). Backup solutions developed by experts on the topic are paths to reliability. -- Michael