Traditional Barman Setup With WAL archiving via archive_command in PostgreSQL
In the previous blog, we saw How To Configure Traditional Barman Backup Setup via rsync/ssh Click here to read more. In this blog, we will replace archive_command for WAL archiving via rsync with barman-wal-archive.
From Barman 2.6, the recommended way to safely and reliably archive WAL files to Barman via archive_command is to use the barman-wal-archive command contained in the barman-cli package. We can also use rsync/SSH as in archive_command. But with rsync/SSH method there is no mechanism that guarantees that the content of the file is flushed and fsync-ed to disk on Barman Server.
Follow the below steps to Configure WAL archiving via archive_command
Follow the same steps as in the blog How To Configure Traditional Barman Backup Setup via rsync/ssh Click here to read more from Step 1 to Step 13. In Step 13 Use the below command for archive_command instead of rsync.
[root@test-machine02 ~]# cd /var/lib/pgsql/13/data/ [root@test-machine02 data]# vi postgresql.conf archive_mode = on archive_command = 'barman-wal-archive test-machine01 test-machine02 %p' :wq! [root@test-machine02 system]# systemctl restart postgresql-13 [root@test-machine02 system]# [root@test-machine02 ~]# su - postgres Last login: Sun Jul 11 10:56:42 +03 2021 on pts/1 -bash-4.2$ psql psql (13.2) Type "help" for help. postgres=# postgres=# select name,setting,unit from pg_settings where name in ('archive_mode','wal_level','archive_command'); name | setting | unit -----------------+-----------------------------------------------------+------ archive_command | barman-wal-archive test-machine01 test-machine02 %p | archive_mode | on | wal_level | replica | (3 rows) postgres=#
Step 13.1. Check barman-wal-archive working in Barman server: You can check that barman-wal-archive can connect to the Barman server, and that the required PostgreSQL server is configured in Barman to accept incoming WAL files with the following command:
-bash-4.2$ -bash-4.2$ barman-wal-archive --test test-machine01 test-machine02 DUMMY barman@test-machine01's password: Ready to accept WAL files for the server test-machine02 -bash-4.2$
Once the above steps are done you can continue from Step 14 of the same blog How To Configure Traditional Barman Backup Setup via rsync/ssh.
References: BARMAN Document: http://docs.pgbarman.org/release/2.12/
For BARMAN Backup Command: https://dbsguru.com/physical-postgresql-backup-using-barman/
For BARMAN Restore Command: https://dbsguru.com/restore-backup-using-barman-in-postgresql/
For BARMAN PITR Comamnd: https://dbsguru.com/point-in-time-recovery-using-barman-in-postgresql/
This document is just for learning purpose and always validate in the LAB environment first before applying in the LIVE environment.
Hope so you like this article!
Please share your valuable feedback/comments/subscribe and follow us below and don’t forget to click on the bell icon to get the most recent update. Click here to understand more about our pursuit.
- Setup Logical Replication using pglogical in PostgreSQL
- Backups from the Standby Server using pgBackRest in PostgreSQL
- Setup Streaming Replication with pgBackRest in PostgreSQL
- Configure automatic failover with repmgrd in PostgreSQL
- Perform Manual Failover & Switchover using repmgr in PostgreSQL
1,178 Total Views, 7 Views Today
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?
Hello and welcome to DBsGuru,
I’m Jamsher Khan working as Senior Oracle DBA based in KSA-Jeddah, I have working experience in Oracle DBA, SQL Server, MySql, PostgreSQL, Linux, Golden Gate, ODA.
Thanks for the visits!
Share Learn Grow!