1. Add PostgreSQL Yum Repository:
[root]# dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
2. Confirm the list of enabled repositories:
[root]#
dnf repolist
dnf clean all
3. Installation Barman and PostgreSQL server software:
[root@barman-bcp]#
dnf -qy module disable postgresql
dnf install -y barman.noarch postgresql14-server postgresql14
4. Add password user for user barman:
[root@barman-bcp ]#
passwd barman
5. Configure Passwordless Authentication in PosgreSQL Server:
[barman@barman-bcp]$
ssh-keygen -t rsa -b 2048
cat ~/.ssh/id_rsa.pub|ssh postgres@pg-db01 "cat >>~/.ssh/authorized_keys"
-- check
ssh postgres@pg-db01
6. Check configuration of Barman
[root@barman-bcp]# cat /etc/barman.conf
7. PostgreSQL database configuration file for Barman:
[root@barman-bcp]# cat /etc/barman.d/pg.conf
[pg-db01]
description = "pg-db01 backup config"
ssh_command = "ssh postgres@pg-db01"
conninfo = host=pg-db01 user=barman port=5432 dbname=postgres
backup_options = concurrent_backup
backup_method = rsync
archiver = on
streaming_conninfo = host=pg-db01 user=streaming_barman port=5432 dbname=postgres
streaming_archiver = on
slot_name = barman
create_slot = auto
compression = gzip
network_compression = true
parallel_jobs = 4
retention_policy = RECOVERY WINDOW OF 8 DAYS
8. Create file with password at /var/lib/barman/.pgpass and add:
pg-db01:5432:*:barman:pasword123
pg-db01:5432:*:streaming_barman:pasword123
and
chmod 600 /var/lib/barman/.pgpass
9. Add to Environment (~/.bash_profile):
export PATH=/usr/pgsql-14/bin/:/usr/sbin:/usr/bin:/usr/sbin:/usr/bin:/sbin:/bin
export PGPASSFILE=/var/lib/barman/.pgpass
10.
[barman@barman-bcp]$ barman receive-wal pg-db01 &
11. Check server configuration:
[barman@barman-bcp]$ barman check pg-db01
12. List available servers:
[barman@barman-bcp]$ barman list-server
pg-db01 - pg-db01 backup config
13.
[barman@barman-bcp]$ barman status pg-db01
14. Check a replication status:
[barman@barman-bcp]$ barman replication-status pg-db01
15. Manual switch WAL on database:
[barman@barman-bcp]$ barman switch-wal --force --archive pg-db01
16. Show configured parameters:
[barman@barman-bcp]$ barman show-server pg-db01
17. Barman's log:
[barman@barman-bcp]$ tail -100f /var/log/barman/barman.log
No comments:
Post a Comment