()

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.

 

 

Releated articles


Loading

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Jamsher Khan

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!

2 thoughts on “Traditional Barman Setup With WAL archiving via archive_command in PostgreSQL

  1. Hi my friend! I wish to ѕay that tһis post іs аmazing, nice writtеn ɑnd ϲome with aⅼmost all significant infos.
    I’d like to look more posts ⅼike this .

Comments are closed.