patternsqlMinor
multiple archive_command in PostgreSQL
Viewed 0 times
archive_commandpostgresqlmultiple
Problem
I have replication with PostgreSQL, so I want to set
So is it possible to have multiple
archive_command = 'cp %p /var/lib/postgresql/11/main/archive/%f' but I also want to save WAL files to another safe place: S3.So is it possible to have multiple
archive_commands? And can I put this command on the slave to push wal files to S3 instead of on the master - I want master to have less performance impact.Solution
You don't need multiple
The
You can also defer archiving to S3 to the standby server, but then you have to set
archive_commands:archive_command = 'cp %p /.../%f && (command to archive to S3)'The
&& is interpreted by the shell. If the cp has a non-zero return code, that will be the result of archive_command. If the result is 0 (success), the second command is executed, and its return code will be the result of archive_command.You can also defer archiving to S3 to the standby server, but then you have to set
archive_mode = always there. The disadvantage is that the configuration on primary and standby will be different, which makes failover more complicated. Does the command to archive a file to S3 really cause a substantial performance impact?Code Snippets
archive_command = 'cp %p /.../%f && (command to archive to S3)'Context
StackExchange Database Administrators Q#252471, answer score: 2
Revisions (0)
No revisions yet.