Barman install and backup
[root@postonline bin]# ls -lrt python*
-rwxr-xr-x. 1 root root 7144 May 27 2020 python2.7
-rwxr-xr-x. 2 root root 11336 Nov 11 2020 python3.6m
-rwxr-xr-x. 2 root root 11336 Nov 11 2020 python3.6
lrwxrwxrwx. 1 root root 7 Nov 26 2020 python -> python2
lrwxrwxrwx. 1 root root 9 Nov 26 2020 python2 -> python2.7
lrwxrwxrwx. 1 root root 9 Nov 26 2020 python3 -> python3.6
[root@postonline bin]# alias python=/usr/bin/python3.6
[root@postonline bin]# python --version
Python 3.6.8
[root@postonline bin]#
[root@postonline ~]# pwd
/root
[root@postonline ~]# cat .bash_aliases
alias python=/usr/bin/python3.6
alias python3=/usr/bin/python3.6
[root@postonline ~]#
[root@postonline ~]# rpm -qa python3*
python3-pip-9.0.3-8.el7.noarch
python3-libs-3.6.8-18.0.1.el7.x86_64
python3-3.6.8-18.0.1.el7.x86_64
python3-setuptools-39.2.0-10.el7.noarch
[root@postonline ~]#
sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
[root@localhost yum.repos.d]# pwd
/etc/yum.repos.d
[root@localhost yum.repos.d]#
-rw-r--r--. 1 root root 1358 Sep 4 2021 epel.repo
[root@postonline yumdownloaddir]# yum search barman
Loaded plugins: langpacks, ulninfo
================================================================ N/S matched: barman ================================================================
barman-cli.noarch : Client Utilities for Barman
python3-barman.noarch : Shared libraries for Barman
barman.noarch : Backup and Recovery Manager for PostgreSQL
Name and summary matches only, use "search all" for everything.
[root@postonline yumdownloaddir]#
sudo repotrack parted barman* python3-barman*
OUTPUT:
Downloading ustr-1.0.4-16.el7.x86_64.rpm
Downloading util-linux-2.23.2-65.0.4.el7_9.1.i686.rpm
Downloading util-linux-2.23.2-65.0.4.el7_9.1.x86_64.rpm
Downloading xz-5.2.2-2.el7_9.x86_64.rpm
Downloading xz-libs-5.2.2-2.el7_9.x86_64.rpm
Downloading xz-libs-5.2.2-2.el7_9.i686.rpm
Downloading zlib-1.2.7-21.el7_9.x86_64.rpm
Downloading zlib-1.2.7-21.el7_9.i686.rpm
[root@postonline barman_rpm]#
[root@postonline barman_rpm]# pwd
/tmp/barman_rpm
[root@postonline barman_rpm]# sudo createrepo /tmp/barman_rpm
Spawning worker 0 with 129 pkgs
Spawning worker 1 with 128 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@postonline barman_rpm]#
[root@postonline barman_rpm]# cp -r repodata /usr/share/nginx/html/barman_rpm
[root@localhost yum.repos.d]# pwd
/etc/yum.repos.d
[root@localhost yum.repos.d]# ls -lrt epel.repo.orig
-rw-r--r--. 1 root root 1358 Sep 4 2021 epel.repo.orig
[root@localhost yum.repos.d]# cat local-repos.repo
[local-repos]
name=Local repository storage on <server-FQDN>
baseurl=http://postonline/yumdownloaddir/
gpgcheck=0
enabled=1
[barman-repos]
name=Local repository storage on <server-FQDN>
baseurl=http://postonline/barman_rpm/
gpgcheck=0
enabled=1
[root@localhost yum.repos.d]#
[root@postonline barman_rpm]# yum search barman
Loaded plugins: langpacks, ulninfo
barman-repos | 2.9 kB 00:00:00
local-repos | 2.9 kB 00:00:00
barman-repos/primary_db | 188 kB 00:00:00
================================================================ N/S matched: barman ================================================================
barman-cli.noarch : Client Utilities for Barman
python3-barman.noarch : Shared libraries for Barman
barman.noarch : Backup and Recovery Manager for PostgreSQL
Name and summary matches only, use "search all" for everything.
[root@postonline barman_rpm]#
[root@postonline barman_rpm]# yum install barman -y
Loaded plugins: langpacks, ulninfo
Resolving Dependencies
--> Running transaction check
---> Package barman.noarch 0:3.10.0-1.el7 will be installed
--> Processing Dependency: python3.6dist(python-dateutil) for package: barman-3.10.0-1.el7.noarch
--> Processing Dependency: python3.6dist(psycopg2) for package: barman-3.10.0-1.el7.noarch
--> Processing Dependency: python3.6dist(barman) for package: barman-3.10.0-1.el7.noarch
--> Processing Dependency: python3.6dist(argcomplete) for package: barman-3.10.0-1.el7.noarch
--> Running transaction check
---> Package python3-barman.noarch 0:3.10.0-1.el7 will be installed
---> Package python3-psycopg2.x86_64 0:2.7.7-2.el7 will be installed
---> Package python36-argcomplete.noarch 0:1.7.0-5.el7 will be installed
---> Package python36-dateutil.noarch 1:2.4.2-6.el7 will be installed
--> Processing Dependency: python36-six for package: 1:python36-dateutil-2.4.2-6.el7.noarch
--> Running transaction check
---> Package python36-six.noarch 0:1.14.0-3.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================================
Installing:
barman noarch 3.10.0-1.el7 barman-repos 31 k
Installing for dependencies:
python3-barman noarch 3.10.0-1.el7 barman-repos 548 k
python3-psycopg2 x86_64 2.7.7-2.el7 barman-repos 157 k
python36-argcomplete noarch 1.7.0-5.el7 barman-repos 47 k
python36-dateutil noarch 1:2.4.2-6.el7 barman-repos 84 k
python36-six noarch 1.14.0-3.el7 barman-repos 34 k
Transaction Summary
=====================================================================================================================================================
Install 1 Package (+5 Dependent packages)
Total download size: 901 k
Installed size: 4.6 M
Downloading packages:
(1/6): barman-3.10.0-1.el7.noarch.rpm | 31 kB 00:00:00
(2/6): python3-psycopg2-2.7.7-2.el7.x86_64.rpm | 157 kB 00:00:00
(3/6): python36-argcomplete-1.7.0-5.el7.noarch.rpm | 47 kB 00:00:00
(4/6): python3-barman-3.10.0-1.el7.noarch.rpm | 548 kB 00:00:00
(5/6): python36-dateutil-2.4.2-6.el7.noarch.rpm | 84 kB 00:00:00
(6/6): python36-six-1.14.0-3.el7.noarch.rpm | 34 kB 00:00:00
-----------------------------------------------------------------------------------------------------------------------------------------------------
Total 2.0 MB/s | 901 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : python36-argcomplete-1.7.0-5.el7.noarch 1/6
Installing : python36-six-1.14.0-3.el7.noarch 2/6
Installing : 1:python36-dateutil-2.4.2-6.el7.noarch 3/6
Installing : python3-barman-3.10.0-1.el7.noarch 4/6
Installing : python3-psycopg2-2.7.7-2.el7.x86_64 5/6
Installing : barman-3.10.0-1.el7.noarch 6/6
Verifying : python3-psycopg2-2.7.7-2.el7.x86_64 1/6
Verifying : barman-3.10.0-1.el7.noarch 2/6
Verifying : 1:python36-dateutil-2.4.2-6.el7.noarch 3/6
Verifying : python3-barman-3.10.0-1.el7.noarch 4/6
Verifying : python36-six-1.14.0-3.el7.noarch 5/6
Verifying : python36-argcomplete-1.7.0-5.el7.noarch 6/6
Installed:
barman.noarch 0:3.10.0-1.el7
Dependency Installed:
python3-barman.noarch 0:3.10.0-1.el7 python3-psycopg2.x86_64 0:2.7.7-2.el7 python36-argcomplete.noarch 0:1.7.0-5.el7
python36-dateutil.noarch 1:2.4.2-6.el7 python36-six.noarch 0:1.14.0-3.el7
Complete!
[root@postonline barman_rpm]#
[root@postonline barman_rpm]# passwd barman
Changing password for user barman.
New password:
BAD PASSWORD: The password fails the dictionary check - it is based on a dictionary word
Retype new password:
passwd: all authentication tokens updated successfully.
[root@postonline barman_rpm]#
[gopal@postoffline tmp]$ su - enterprisedb
Password:
Last login: Tue Feb 27 09:41:49 IST 2024 on :0
-bash-4.2$
-bash-4.2$ pwd
/usr/edb/as14/bin
-bash-4.2$ ./psql -U enterprisedb -d dev
psql (14.11.0)
Type "help" for help.
dev=# \du+
List of roles
Role name | Attributes | Member of | Description
-----------------------+------------------------------------------------------------+-----------+-------------
aq_administrator_role | No inheritance, Cannot login +| {} |
| Profile default | |
enterprisedb | Superuser, Create role, Create DB, Replication, Bypass RLS+| {} |
| Profile default | |
test | Superuser +| {} |
| Profile default | |
dev=# create user barman superuser password 'password';
CREATE ROLE
dev=# \du+
List of roles
Role name | Attributes | Member of | Description
-----------------------+------------------------------------------------------------+-----------+-------------
aq_administrator_role | No inheritance, Cannot login +| {} |
| Profile default | |
barman | Superuser +| {} |
| Profile default | |
enterprisedb | Superuser, Create role, Create DB, Replication, Bypass RLS+| {} |
| Profile default | |
test | Superuser +| {} |
| Profile default | |
dev=#
[root@postonline ~]# su - barman
-bash-4.2$ id
uid=984(barman) gid=978(barman) groups=978(barman) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
-bash-4.2$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/var/lib/barman/.ssh/id_rsa):
Created directory '/var/lib/barman/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /var/lib/barman/.ssh/id_rsa.
Your public key has been saved in /var/lib/barman/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:A9Jm7/+g0sCigd/IsZsDwj/ojuaTJRBqG7vLN3cWs3s barman@postonline
The key's randomart image is:
+---[RSA 2048]----+
| |
|. . |
|.. . = |
|oo + o |
|+.+ . S |
|+=o.. o+ . |
|.+BB . o= . |
|o*B*...+.E . |
|***o+ oo+ ... |
+----[SHA256]-----+
-bash-4.2$
ssh-copy-id -i ~/.ssh/id_rsa.pub enterprisedb@postoffline
-bash-4.2$ ls -lrt
total 8
-rw-r--r--. 1 enterprisedb enterprisedb 406 Feb 27 11:18 id_rsa.pub
-rw-------. 1 enterprisedb enterprisedb 1675 Feb 27 11:18 id_rsa
-bash-4.2$ ssh-copy-id -i ~/.ssh/id_rsa.pub enterprisedb@postoffline
/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/var/lib/barman/.ssh/id_rsa.pub"
The authenticity of host 'postoffline (192.168.1.103)' can't be established.
ECDSA key fingerprint is SHA256:ilUXcYzGqS0pVUkWcLH6vDDDS8QpiCVMXNijL//KMD4.
ECDSA key fingerprint is MD5:2f:2e:2d:29:b9:43:d8:60:0f:f2:52:04:02:ca:fc:cd.
Are you sure you want to continue connecting (yes/no)? yes
/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
enterprisedb@postoffline's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'enterprisedb@postoffline'"
and check to make sure that only the key(s) you wanted were added.
-bash-4.2$
-bash-4.2$ ls -lrt
total 12
-rw-r--r--. 1 barman barman 399 Feb 27 11:15 id_rsa.pub
-rw-------. 1 barman barman 1679 Feb 27 11:15 id_rsa
-rw-r--r--. 1 barman barman 187 Feb 27 11:20 known_hosts
-bash-4.2$
-bash-4.2$ ls -lrt
total 12
-rw-r--r--. 1 enterprisedb enterprisedb 406 Feb 27 11:18 id_rsa.pub
-rw-------. 1 enterprisedb enterprisedb 1675 Feb 27 11:18 id_rsa
-rw-------. 1 enterprisedb enterprisedb 399 Feb 27 11:20 authorized_keys
-bash-4.2$
-bash-4.2$ id
uid=986(enterprisedb) gid=980(enterprisedb) groups=980(enterprisedb),26(postgres) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
-bash-4.2$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/var/lib/edb/.ssh/id_rsa):
Created directory '/var/lib/edb/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /var/lib/edb/.ssh/id_rsa.
Your public key has been saved in /var/lib/edb/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:/tW072BH4fAzkjr4qKlEEtLIKLhj1jkjLv6zci8nyUY enterprisedb@postoffline
The key's randomart image is:
+---[RSA 2048]----+
| |
|+ o |
|++ o . . |
|..o o = .|
|o+ * . S o.=.|
|+..E= . . .o.oo|
|..o .. .. o. = .|
|o. O.. ..o... + |
| .=oBo.o.... .o|
+----[SHA256]-----+
-bash-4.2$
ssh-copy-id -i ~/.ssh/id_rsa.pub barman@postonline
-bash-4.2$ ssh-copy-id -i ~/.ssh/id_rsa.pub barman@postonline
/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/var/lib/edb/.ssh/id_rsa.pub"
The authenticity of host 'postonline (192.168.1.102)' can't be established.
ECDSA key fingerprint is SHA256:ilUXcYzGqS0pVUkWcLH6vDDDS8QpiCVMXNijL//KMD4.
ECDSA key fingerprint is MD5:2f:2e:2d:29:b9:43:d8:60:0f:f2:52:04:02:ca:fc:cd.
Are you sure you want to continue connecting (yes/no)? yes
/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
barman@postonline's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'barman@postonline'"
and check to make sure that only the key(s) you wanted were added.
-bash-4.2$ ls -lrt
total 16
-rw-r--r--. 1 enterprisedb enterprisedb 406 Feb 27 11:18 id_rsa.pub
-rw-------. 1 enterprisedb enterprisedb 1675 Feb 27 11:18 id_rsa
-rw-------. 1 enterprisedb enterprisedb 399 Feb 27 11:20 authorized_keys
-rw-r--r--. 1 enterprisedb enterprisedb 186 Feb 27 11:23 known_hosts
-bash-4.2$
-bash-4.2$ ls -lrt
total 16
-rw-r--r--. 1 barman barman 399 Feb 27 11:15 id_rsa.pub
-rw-------. 1 barman barman 1679 Feb 27 11:15 id_rsa
-rw-r--r--. 1 barman barman 187 Feb 27 11:20 known_hosts
-rw-------. 1 barman barman 406 Feb 27 11:23 authorized_keys
-bash-4.2$
[root@postonline barman]# pwd
/etc/barman
[root@postonline barman]# ls -lrt
total 12
drwxr-xr-x. 2 root root 4096 Feb 27 11:07 conf.d
-rw-r--r--. 1 root root 3511 Feb 27 11:34 barman.conf.orig
-rw-r--r--. 1 root root 3507 Feb 27 11:37 barman.conf
[root@postonline barman]# diff barman.conf barman.conf.orig
27c27
< compression = gzip
---
> ;compression = gzip
60c60
< immediate_checkpoint = true
---
> ;immediate_checkpoint = false
66c66
< basebackup_retry_times = 3
---
> ;basebackup_retry_times = 0
102,103d101
<
< reuse_backup = link
[root@postonline barman]#
[root@postonline conf.d]# pwd
/etc/barman/conf.d
[root@postonline conf.d]# cat dev-pgsql.conf
[dev-pgsql]
description = "dev-pgsql backup config"
ssh_command = ssh enterprisedb@postoffline
conninfo = host=postoffline user=barman port=5444 dbname=dev password=password
backup_options = concurrent_backup
backup_method = rsync
archiver = on
[root@postonline conf.d]#
[root@postonline barman]# barman check dev-pgsql
Server dev-pgsql:
WAL archive: FAILED (please make sure WAL shipping is setup)
PostgreSQL: FAILED
directories: OK
retention policy settings: OK
backup maximum age: OK (no last_backup_maximum_age provided)
backup minimum size: OK (0 B)
wal maximum age: OK (no last_wal_maximum_age provided)
wal size: OK (0 B)
compression settings: OK
failed backups: OK (there are 0 failed backups)
minimum redundancy requirements: OK (have 0 backups, expected at least 0)
ssh: OK (PostgreSQL server)
systemid coherence: OK (no system Id available)
archiver errors: OK
[root@postonline barman]#
-bash-4.2$ pwd
/database/edb/as14
-bash-4.2$ cat postgresql.conf | grep archive
archive_mode = on # enables archiving; off, on, or always
archive_command = 'test ! -f barman@postonline:/var/lib/barman/dev-pgsql/incoming/%f && rsync -a %p barman@postonline:/var/lib/barman/dev-pgsql/incoming/%f'
systemctl status edb-as-14.service
systemctl stop edb-as-14.service
systemctl start edb-as-14.service
systemctl status edb-as-14.service
OUTPUT:
[root@postoffline ~]# systemctl status edb-as-14.service
● edb-as-14.service - EDB Postgres Advanced Server 14
Loaded: loaded (/usr/lib/systemd/system/edb-as-14.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2024-02-27 09:41:06 IST; 2h 15min ago
Process: 1314 ExecStartPre=/usr/edb/as14/bin/edb-as-14-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
Main PID: 1332 (edb-postmaster)
Tasks: 9
CGroup: /system.slice/edb-as-14.service
├─1332 /usr/edb/as14/bin/edb-postmaster -D /database/edb/as14
├─1590 postgres: logger
├─1740 postgres: checkpointer
├─1741 postgres: background writer
├─1742 postgres: walwriter
├─1745 postgres: autovacuum launcher
├─1746 postgres: stats collector
├─1750 postgres: dbms_aq launcher
└─1752 postgres: logical replication launcher
Feb 27 09:41:01 postoffline systemd[1]: Starting EDB Postgres Advanced Server 14...
Feb 27 09:41:05 postoffline edb-postmaster[1332]: 2024-02-27 09:41:05 IST LOG: redirecting log output to logging collector process
Feb 27 09:41:05 postoffline edb-postmaster[1332]: 2024-02-27 09:41:05 IST HINT: Future log output will appear in directory "log".
Feb 27 09:41:06 postoffline systemd[1]: Started EDB Postgres Advanced Server 14.
[root@postoffline ~]# systemctl stop edb-as-14.service
[root@postoffline ~]# systemctl status edb-as-14.service
● edb-as-14.service - EDB Postgres Advanced Server 14
Loaded: loaded (/usr/lib/systemd/system/edb-as-14.service; enabled; vendor preset: disabled)
Active: inactive (dead) since Tue 2024-02-27 11:56:35 IST; 9s ago
Process: 1332 ExecStart=/usr/edb/as14/bin/edb-postmaster -D ${PGDATA} (code=exited, status=0/SUCCESS)
Process: 1314 ExecStartPre=/usr/edb/as14/bin/edb-as-14-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
Main PID: 1332 (code=exited, status=0/SUCCESS)
Tasks: 0
CGroup: /system.slice/edb-as-14.service
Feb 27 09:41:01 postoffline systemd[1]: Starting EDB Postgres Advanced Server 14...
Feb 27 09:41:05 postoffline edb-postmaster[1332]: 2024-02-27 09:41:05 IST LOG: redirecting log output to logging collector process
Feb 27 09:41:05 postoffline edb-postmaster[1332]: 2024-02-27 09:41:05 IST HINT: Future log output will appear in directory "log".
Feb 27 09:41:06 postoffline systemd[1]: Started EDB Postgres Advanced Server 14.
Feb 27 11:56:35 postoffline systemd[1]: Stopping EDB Postgres Advanced Server 14...
Feb 27 11:56:35 postoffline systemd[1]: Can't convert PID files /database/edb/as14 O_PATH file descriptor to proper file descriptor: Is a directory
Feb 27 11:56:35 postoffline systemd[1]: Stopped EDB Postgres Advanced Server 14.
[root@postoffline ~]# systemctl start edb-as-14.service
[root@postoffline ~]# systemctl status edb-as-14.service
● edb-as-14.service - EDB Postgres Advanced Server 14
Loaded: loaded (/usr/lib/systemd/system/edb-as-14.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2024-02-27 11:56:57 IST; 8s ago
Process: 7142 ExecStartPre=/usr/edb/as14/bin/edb-as-14-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
Main PID: 7150 (edb-postmaster)
Tasks: 10
CGroup: /system.slice/edb-as-14.service
├─7150 /usr/edb/as14/bin/edb-postmaster -D /database/edb/as14
├─7154 postgres: logger
├─7156 postgres: checkpointer
├─7157 postgres: background writer
├─7158 postgres: walwriter
├─7159 postgres: autovacuum launcher
├─7160 postgres: archiver
├─7161 postgres: stats collector
├─7162 postgres: dbms_aq launcher
└─7163 postgres: logical replication launcher
Feb 27 11:56:55 postoffline systemd[1]: Starting EDB Postgres Advanced Server 14...
Feb 27 11:56:55 postoffline edb-postmaster[7150]: 2024-02-27 11:56:55 IST LOG: redirecting log output to logging collector process
Feb 27 11:56:55 postoffline edb-postmaster[7150]: 2024-02-27 11:56:55 IST HINT: Future log output will appear in directory "log".
Feb 27 11:56:57 postoffline systemd[1]: Started EDB Postgres Advanced Server 14.
[root@postoffline ~]#
[root@postonline barman]# barman check dev-pgsql
Server dev-pgsql:
WAL archive: FAILED (please make sure WAL shipping is setup)
PostgreSQL: FAILED
directories: OK
retention policy settings: OK
backup maximum age: OK (no last_backup_maximum_age provided)
backup minimum size: OK (0 B)
wal maximum age: OK (no last_wal_maximum_age provided)
wal size: OK (0 B)
compression settings: OK
failed backups: OK (there are 0 failed backups)
minimum redundancy requirements: OK (have 0 backups, expected at least 0)
ssh: OK (PostgreSQL server)
systemid coherence: OK (no system Id available)
archiver errors: OK
[root@postonline barman]#
bash-4.2$ cat postgresql.conf | grep wal_level
wal_level = replica # minimal, replica, or logical
bash-4.2$
[root@postonline dev-pgsql]# barman check dev-pgsql
Server dev-pgsql:
PostgreSQL: FAILED
directories: OK
retention policy settings: OK
backup maximum age: OK (no last_backup_maximum_age provided)
backup minimum size: OK (0 B)
wal maximum age: OK (no last_wal_maximum_age provided)
wal size: OK (0 B)
compression settings: OK
failed backups: OK (there are 0 failed backups)
minimum redundancy requirements: OK (have 0 backups, expected at least 0)
ssh: OK (PostgreSQL server)
systemid coherence: OK (no system Id available)
archiver errors: OK
[root@postonline dev-pgsql]#
-bash-4.2$ psql -h postoffline -p 5444 -U barman -d dev
psql: connection to server at "postoffline" (192.168.1.103), port 5444 failed: No route to host
Is the server running on that host and accepting TCP/IP connections?
-bash-4.2$
[root@postoffline ~]# firewall-cmd --list-services
dhcpv6-client ssh
[root@postoffline ~]# firewall-cmd --add-service=postgresql --permanent
success
[root@postoffline ~]# firewall-cmd --list-services
dhcpv6-client ssh
[root@postoffline ~]# firewall-cmd --add-service=edb-postmaster --permanent
Error: INVALID_SERVICE: 'edb-postmaster' not among existing services
[root@postoffline ~]#
[root@postoffline ~]# firewall-cmd --add-port=5444/tcp
success
[root@postoffline ~]# firewall-cmd --list-services
dhcpv6-client ssh
[root@postoffline ~]#
psql -h postoffline -p 5444 -U barman -d dev
-bash-4.2$ psql -h postoffline -p 5444 -U barman -d dev
psql: connection to server at "postoffline" (192.168.1.103), port 5444 failed: FATAL: no pg_hba.conf entry for host "192.168.1.102", user "barman", database "dev", no encryption
-bash-4.2$
-bash-4.2$ cat pg_hba.conf | grep barman
host all barman 192.168.1.102/32 md5
-bash-4.2$
-bash-4.2$ psql -h postoffline -p 5444 -U barman -d dev
Password for user barman:
psql (9.2.24, server 14.11.0)
WARNING: psql version 9.2, server version 14.0.
Some psql features might not work.
Type "help" for help.
dev=# exit
dev-# \q
-bash-4.2$
-bash-4.2$ barman check dev-pgsql
Server dev-pgsql:
PostgreSQL: OK
superuser or standard user with backup privileges: OK
wal_level: OK
directories: OK
retention policy settings: OK
backup maximum age: OK (no last_backup_maximum_age provided)
backup minimum size: OK (0 B)
wal maximum age: OK (no last_wal_maximum_age provided)
wal size: OK (0 B)
compression settings: OK
failed backups: OK (there are 0 failed backups)
minimum redundancy requirements: OK (have 0 backups, expected at least 0)
ssh: OK (PostgreSQL server)
systemid coherence: OK (no system Id stored on disk)
archive_mode: OK
archive_command: OK
continuous archiving: OK
archiver errors: OK
-bash-4.2$
-bash-4.2$ barman show-server dev-pgsql
Server dev-pgsql:
active: True
archive_command: test ! -f barman@postonline:/var/lib/barman/dev-pgsql/incoming/%f && rsync -a %p barman@postonline:/var/lib/barman/dev-pgsql/incoming/%f
archive_mode: on
archive_timeout: 0
archived_count: 0
archiver: True
archiver_batch_size: 0
autogenerate_manifest: False
aws_profile: None
aws_region: None
azure_credential: None
azure_resource_group: None
azure_subscription_id: None
backup_compression: None
backup_compression_format: None
backup_compression_level: None
backup_compression_location: None
backup_compression_workers: None
backup_directory: /var/lib/barman/dev-pgsql
backup_method: rsync
backup_options: BackupOptions({'concurrent_backup'})
bandwidth_limit: None
barman_home: /var/lib/barman
barman_lock_directory: /var/lib/barman
basebackup_retry_sleep: 30
basebackup_retry_times: 3
basebackups_directory: /var/lib/barman/dev-pgsql/base
check_timeout: 30
checkpoint_timeout: 300
cluster: dev-pgsql
compression: gzip
config_changes_queue: /var/lib/barman/cfg_changes.queue
config_file: /database/edb/as14/postgresql.conf
conninfo: host=postoffline user=barman port=5444 dbname=dev password=*REDACTED* create_slot: manual
current_archived_wals_per_second: 0E-24
current_lsn: 0/80000D8
current_size: 92680766
current_xlog: 000000010000000000000008
custom_compression_filter: None
custom_compression_magic: None
custom_decompression_filter: None
data_checksums: off
data_directory: /database/edb/as14
description: dev-pgsql backup config
disabled: False
errors_directory: /var/lib/barman/dev-pgsql/errors
failed_count: 0
forward_config_path: False
gcp_project: None
gcp_zone: None
has_backup_privileges: True
has_monitoring_privileges: True
hba_file: /database/edb/as14/pg_hba.conf
hot_standby: on
ident_file: /database/edb/as14/pg_ident.conf
immediate_checkpoint: True
incoming_wals_directory: /var/lib/barman/dev-pgsql/incoming
is_archiving: True
is_in_recovery: False
is_superuser: True
last_archived_time: None
last_archived_wal: None
last_backup_maximum_age: None
last_backup_minimum_size: None
last_failed_time: None
last_failed_wal: None
last_wal_maximum_age: None
lock_directory_cleanup: True
max_incoming_wals_queue: None
max_replication_slots: 10
max_wal_senders: 10
minimum_redundancy: 0
msg_list: []
name: dev-pgsql
network_compression: False
parallel_jobs: 1
parallel_jobs_start_batch_period: 1
parallel_jobs_start_batch_size: 10
passive_node: False
path_prefix: None
post_archive_retry_script: None
post_archive_script: None
post_backup_retry_script: None
post_backup_script: None
post_delete_retry_script: None
post_delete_script: None
post_recovery_retry_script: None
post_recovery_script: None
post_wal_delete_retry_script: None
post_wal_delete_script: None
postgres_systemid: 7339477999368590607
pre_archive_retry_script: None
pre_archive_script: None
pre_backup_retry_script: None
pre_backup_script: None
pre_delete_retry_script: None
pre_delete_script: None
pre_recovery_retry_script: None
pre_recovery_script: None
pre_wal_delete_retry_script: None
pre_wal_delete_script: None
primary_checkpoint_timeout: 0
primary_conninfo: None
primary_ssh_command: None
recovery_options: RecoveryOptions()
recovery_staging_path: None
replication_slot: None
replication_slot_support: True
retention_policy: None
retention_policy_mode: auto
reuse_backup: link
server_txt_version: 14.11
slot_name: None
snapshot_disks: None
snapshot_gcp_project: None
snapshot_instance: None
snapshot_provider: None
snapshot_zone: None
ssh_command: ssh enterprisedb@postoffline
stats_reset: 2024-02-25 15:34:19.158051+05:30
streaming_archiver: False
streaming_archiver_batch_size: 0
streaming_archiver_name: barman_receive_wal
streaming_backup_name: barman_streaming_backup
streaming_conninfo: host=postoffline user=barman port=5444 dbname=dev password=*REDACTED* streaming_wals_directory: /var/lib/barman/dev-pgsql/streaming
synchronous_standby_names: ['']
tablespace_bandwidth_limit: None
version_supported: True
wal_compression: off
wal_conninfo: None
wal_keep_size: 0
wal_level: replica
wal_retention_policy: main
wal_streaming_conninfo: None
wals_directory: /var/lib/barman/dev-pgsql/wals
xlog_segment_size: 16777216
-bash-4.2$
-bash-4.2$ barman backup dev-pgsql
Starting backup using rsync-concurrent method for server dev-pgsql in /var/lib/barman/dev-pgsql/base/20240227T125109
Backup start at LSN: 0/9000060 (000000010000000000000009, 00000060)
This is the first backup for server dev-pgsql
WAL segments preceding the current backup have been found:
000000010000000000000002 from server dev-pgsql has been removed
000000010000000000000003 from server dev-pgsql has been removed
000000010000000000000004 from server dev-pgsql has been removed
000000010000000000000005 from server dev-pgsql has been removed
000000010000000000000006 from server dev-pgsql has been removed
000000010000000000000007 from server dev-pgsql has been removed
Starting backup copy via rsync/SSH for 20240227T125109
Copy done (time: 13 seconds)
This is the first backup for server dev-pgsql
Asking PostgreSQL server to finalize the backup.
Backup size: 87.2 MiB. Actual size on disk: 87.2 MiB (-0.00% deduplication ratio).
Backup end at LSN: 0/9000170 (000000010000000000000009, 00000170)
Backup completed (start time: 2024-02-27 12:51:09.761819, elapsed time: 18 seconds)
Processing xlog segments from file archival for dev-pgsql
000000010000000000000008
000000010000000000000009
000000010000000000000009.00000060.backup
-bash-4.2$
-bash-4.2$ barman backup dev-pgsql
Starting backup using rsync-concurrent method for server dev-pgsql in /var/lib/barman/dev-pgsql/base/20240227T125109
Backup start at LSN: 0/9000060 (000000010000000000000009, 00000060)
This is the first backup for server dev-pgsql
WAL segments preceding the current backup have been found:
000000010000000000000002 from server dev-pgsql has been removed
000000010000000000000003 from server dev-pgsql has been removed
000000010000000000000004 from server dev-pgsql has been removed
000000010000000000000005 from server dev-pgsql has been removed
000000010000000000000006 from server dev-pgsql has been removed
000000010000000000000007 from server dev-pgsql has been removed
Starting backup copy via rsync/SSH for 20240227T125109
Copy done (time: 13 seconds)
This is the first backup for server dev-pgsql
Asking PostgreSQL server to finalize the backup.
Backup size: 87.2 MiB. Actual size on disk: 87.2 MiB (-0.00% deduplication ratio).
Backup end at LSN: 0/9000170 (000000010000000000000009, 00000170)
Backup completed (start time: 2024-02-27 12:51:09.761819, elapsed time: 18 seconds)
Processing xlog segments from file archival for dev-pgsql
000000010000000000000008
000000010000000000000009
000000010000000000000009.00000060.backup
-bash-4.2$ barman list-backup dev-pgsql
dev-pgsql 20240227T125109 - Tue Feb 27 12:51:26 2024 - Size: 87.2 MiB - WAL Size: 0 B
dev=# INSERT INTO employee
dev-# VALUES(1,'Annie','Smith','F', DATE '1988-01-09', 'ani@email.com',5000);
INSERT 0 1
dev=# INSERT INTO employee (emp_id, first_name, last_name, gender, birthdate, email)
dev-# VALUES (3, 'May', 'Kaasman', 'M', '1994-07-09', 'mkaasman2@freewebs.com')
dev-# RETURNING emp_id;
emp_id
--------
3
(1 row)
-bash-4.2$ barman backup --reuse=link dev-pgsql
Starting backup using rsync-concurrent method for server dev-pgsql in /var/lib/barman/dev-pgsql/base/20240227T130011
Backup start at LSN: 0/B000028 (00000001000000000000000B, 00000028)
Starting backup copy via rsync/SSH for 20240227T130011
Copy done (time: 1 second)
Asking PostgreSQL server to finalize the backup.
Backup size: 87.3 MiB. Actual size on disk: 5.1 MiB (-94.13% deduplication ratio).
Backup end at LSN: 0/B000138 (00000001000000000000000B, 00000138)
Backup completed (start time: 2024-02-27 13:00:11.488637, elapsed time: 7 seconds)
Processing xlog segments from file archival for dev-pgsql
00000001000000000000000A
00000001000000000000000B
00000001000000000000000B.00000028.backup
-bash-4.2$ barman list-backup dev-pgsql
dev-pgsql 20240227T130011 - Tue Feb 27 13:00:15 2024 - Size: 87.3 MiB - WAL Size: 0 B
dev-pgsql 20240227T125109 - Tue Feb 27 12:51:26 2024 - Size: 87.2 MiB - WAL Size: 83.3 KiB
-bash-4.2$
Comments
Post a Comment