PostgreSQL Full & Incremental Backups with Barman

For now, I'm just going to dump the links I used to get PG-Barman up and running. I'll formalize it a little more later:

Also, I ran into an issue with SELinux blocking some Barman commands related to sending and receiving WAL files over SSH. The correct solution is NOT to disable SELinux. Don't do that. Instead, you can allow the barman-wal-arch file access to the ssh command (which was the issue I ran into):

ausearch -c 'barman-wal-arch' --raw | audit2allow -M my-barmanwalarch
semodule -X 300 -i my-barmanwalarch.pp

TL;DR

This assumes you are running Barman on the same server as PostgreSQL.

Pre-requisites

dnf install python3-pip python3-devel libpq-devel gcc g++ make rsync # if you are using centos, epel-release
pip3 install argcomplete argh psycopg2 python-dateutil setuptools

Install

dnf install barman barman-cli

Configuration

Generate SSH Certificates
su - postgres
ssh-keygen -t rsa
exit

su - barman
ssh-keygen -t rsa
exit

cat /var/lib/pgsql/.ssh/id_rsa.pub >> /var/lib/barman/.ssh/authorized_keys
cat /var/lib/barman/.ssh/id_rsa.pub >> /var/lib/pgsql/.ssh/authorized_keys

# Test it out
su - postgres
ssh barman@localhost
exit
exit

su - barman
ssh postgres@localhost
exit
exit

 


Revision #2
Created Thu, Mar 26, 2020 1:42 PM by Garrett Mills
Updated Thu, Mar 26, 2020 10:57 PM by Garrett Mills