In Part I, we have already configured backup via rsync/SSH. In this section, we will backup database with this method.
Note: Barman implements incremental backup through a global/server option called reuse_backup, that transparently manages the barman backup command. It accepts three values:
- off: standard full backup (default)
- link: incremental backup, by reusing the last backup for a server and creating a hard link of the unchanged files (for backup space and time reduction)
- copy: incremental backup, by reusing the last backup for a server and creating a copy of the unchanged files (just for backup time reduction)
1. Validate configuration
[barman@barman-server ~]$ barman
list-servers
employees4ssh - Backup employees database via rsync/SSH
employees4ssh - Backup employees database via rsync/SSH
[barman@barman-server ~]$ barman
status employees4ssh
[barman@barman-server ~]$ barman
check employees4ssh
Server employees4ssh:
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
archive_mode: OK
archive_command: OK
continuous archiving: OK
archiver errors: OK
Server employees4ssh:
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
archive_mode: OK
archive_command: OK
continuous archiving: OK
archiver errors: OK
[barman@barman-server ~]$ barman
show-server employees4ssh
Server employees4ssh:
active: True
archive_command: barman-wal-archive barman-server employees4ssh %p
archive_mode: on
backup_directory: /barman/backup/employees4ssh
backup_method: rsync
basebackups_directory: /barman/backup/employees4ssh/base
conninfo: host=edb-saigon.taolaoxibup.com user=barman dbname=employees
current_lsn: 0/8DBA0208
current_size: 756601559
current_xlog: 00000001000000000000008D
data_directory: /u01/edb/as16/data
description: Backup employees database via rsync/SSH
errors_directory: /barman/backup/employees4ssh/errors
last_archived_time: 2024-06-12 14:18:51.796703+07:00
last_archived_wal: 00000001000000000000008C
name: employees4ssh
parallel_jobs: 4
ssh_command: ssh enterprisedb@edb-saigon.taolaoxibup.com
streaming_backup_name: barman_streaming_backup
streaming_conninfo: host=edb-saigon.taolaoxibup.com user=barman dbname=employees
streaming_wals_directory: /barman/backup/employees4ssh/streaming
synchronous_standby_names: ['']
wal_level: replica
wal_retention_policy: main
wal_streaming_conninfo: None
wals_directory: /barman/backup/employees4ssh/wals
xlog_segment_size: 16777216
(Note: Only show important information)Server employees4ssh:
active: True
archive_command: barman-wal-archive barman-server employees4ssh %p
archive_mode: on
backup_directory: /barman/backup/employees4ssh
backup_method: rsync
basebackups_directory: /barman/backup/employees4ssh/base
conninfo: host=edb-saigon.taolaoxibup.com user=barman dbname=employees
current_lsn: 0/8DBA0208
current_size: 756601559
current_xlog: 00000001000000000000008D
data_directory: /u01/edb/as16/data
description: Backup employees database via rsync/SSH
errors_directory: /barman/backup/employees4ssh/errors
last_archived_time: 2024-06-12 14:18:51.796703+07:00
last_archived_wal: 00000001000000000000008C
name: employees4ssh
parallel_jobs: 4
ssh_command: ssh enterprisedb@edb-saigon.taolaoxibup.com
streaming_backup_name: barman_streaming_backup
streaming_conninfo: host=edb-saigon.taolaoxibup.com user=barman dbname=employees
streaming_wals_directory: /barman/backup/employees4ssh/streaming
synchronous_standby_names: ['']
wal_level: replica
wal_retention_policy: main
wal_streaming_conninfo: None
wals_directory: /barman/backup/employees4ssh/wals
xlog_segment_size: 16777216
2. Backup Full Database
[barman@barman-server ~]$ barman
backup --reuse-backup=off employees4ssh
Starting backup using rsync-concurrent method for server employees4ssh in /barman/backup/employees4ssh/base/20240612T143538
Backup start at LSN: 0/8E000028 (00000001000000000000008E, 00000028)
This is the first backup for server employees4ssh
WAL segments preceding the current backup have been found:
000000010000000000000067 from server employees4ssh has been removed
000000010000000000000067.00000028.backup from server employees4ssh has been removed
000000010000000000000068 from server employees4ssh has been removed
000000010000000000000069 from server employees4ssh has been removed
...
Starting backup copy via rsync/SSH for 20240612T143538 (4 jobs)
Copy done (time: 8 seconds)
This is the first backup for server employees4ssh
Asking PostgreSQL server to finalize the backup.
Backup size: 1.2 GiB
Backup end at LSN: 0/8E000100 (00000001000000000000008E, 00000100)
Backup completed (start time: 2024-06-12 14:35:39.095970, elapsed time: 13 seconds)
Processing xlog segments from file archival for employees4ssh
00000001000000000000008D
00000001000000000000008E
00000001000000000000008E.00000028.backup
00000001000000000000008F
Starting backup using rsync-concurrent method for server employees4ssh in /barman/backup/employees4ssh/base/20240612T143538
Backup start at LSN: 0/8E000028 (00000001000000000000008E, 00000028)
This is the first backup for server employees4ssh
WAL segments preceding the current backup have been found:
000000010000000000000067 from server employees4ssh has been removed
000000010000000000000067.00000028.backup from server employees4ssh has been removed
000000010000000000000068 from server employees4ssh has been removed
000000010000000000000069 from server employees4ssh has been removed
...
Starting backup copy via rsync/SSH for 20240612T143538 (4 jobs)
Copy done (time: 8 seconds)
This is the first backup for server employees4ssh
Asking PostgreSQL server to finalize the backup.
Backup size: 1.2 GiB
Backup end at LSN: 0/8E000100 (00000001000000000000008E, 00000100)
Backup completed (start time: 2024-06-12 14:35:39.095970, elapsed time: 13 seconds)
Processing xlog segments from file archival for employees4ssh
00000001000000000000008D
00000001000000000000008E
00000001000000000000008E.00000028.backup
00000001000000000000008F
[barman@barman-server ~]$ barman
list-backup employees4ssh
employees4ssh 20240612T143538 - Wed Jun 12 14:35:48 2024 - Size: 1.2 GiB - WAL Size: 16.0 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240612T143538 - Wed Jun 12 14:35:48 2024 - Size: 1.2 GiB - WAL Size: 16.0 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
[barman@barman-server ~]$ barman
show-backup employees4ssh 20240612T143538
Backup 20240612T143538:
Server Name : employees4ssh
System Id : 7377775620992307471
Status : DONE
PostgreSQL Version : 160003
PGDATA directory : /u01/edb/as16/data
Tablespaces:
tbs_ihrp_data : /u01/ihrp/data (oid: 16385)
tbs_ihrp_index : /u01/ihrp/index (oid: 16386)
Base backup
information:
Disk usage : 1.2 GiB (1.2 GiB with WALs)
Incremental size : 1.2 GiB (-0.00%)
Timeline : 1
Begin WAL : 00000001000000000000008E
End WAL : 00000001000000000000008E
WAL number : 1
WAL compression ratio: 99.90%
Begin time : 2024-06-12 14:35:38.562308+07:00
End time : 2024-06-12 14:35:48.753766+07:00
Copy time : 8 seconds + 1 second startup
Estimated throughput : 146.1 MiB/s (4 jobs)
Begin Offset : 40
End Offset : 256
Begin LSN : 0/8E000028
End LSN : 0/8E000100
WAL information:
No of files : 1
Disk usage : 16.0 KiB
WAL rate : 3464.87/hour
Compression ratio : 99.90%
Last available : 00000001000000000000008F
Catalog information:
Retention Policy : not enforced
Previous Backup : - (this is the oldest base backup)
Next Backup : - (this is the latest base backup)
Backup 20240612T143538:
Server Name : employees4ssh
System Id : 7377775620992307471
Status : DONE
PostgreSQL Version : 160003
PGDATA directory : /u01/edb/as16/data
tbs_ihrp_data : /u01/ihrp/data (oid: 16385)
tbs_ihrp_index : /u01/ihrp/index (oid: 16386)
Disk usage : 1.2 GiB (1.2 GiB with WALs)
Incremental size : 1.2 GiB (-0.00%)
Timeline : 1
Begin WAL : 00000001000000000000008E
End WAL : 00000001000000000000008E
WAL number : 1
WAL compression ratio: 99.90%
Begin time : 2024-06-12 14:35:38.562308+07:00
End time : 2024-06-12 14:35:48.753766+07:00
Copy time : 8 seconds + 1 second startup
Estimated throughput : 146.1 MiB/s (4 jobs)
Begin Offset : 40
End Offset : 256
Begin LSN : 0/8E000028
End LSN : 0/8E000100
No of files : 1
Disk usage : 16.0 KiB
WAL rate : 3464.87/hour
Compression ratio : 99.90%
Last available : 00000001000000000000008F
Retention Policy : not enforced
Previous Backup : - (this is the oldest base backup)
Next Backup : - (this is the latest base backup)
Change data in Database server
- Create /Drop tables, indexes
- Insert/Delete/Truncate tables
- Create /Drop tables, indexes
- Insert/Delete/Truncate tables
Switchlog on Barman server
[barman@barman-server ~]$ barman switch-xlog
--force --archive employees4ssh
The WAL file 000000010000000000000090 has been closed on server
'employees4ssh'
Waiting for the WAL file 000000010000000000000090 from server
'employees4ssh' (max: 30 seconds)
Processing xlog segments from file archival for employees4ssh
000000010000000000000090
000000010000000000000090
[barman@barman-server ~]$ barman
list-backup employees4ssh
employees4ssh 20240612T143538 - Wed Jun 12 14:35:48 2024 - Size: 1.2 GiB - WAL Size: 45.7 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240612T143538 - Wed Jun 12 14:35:48 2024 - Size: 1.2 GiB - WAL Size: 45.7 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
--> The Wall Size will change because of recieving wal file from Database Server via archive_command
3. Backup Incremental
Change data in Database server
- Create /Drop tables, indexes
- Insert/Delete/Truncate tables
- Create /Drop tables, indexes
- Insert/Delete/Truncate tables
Check backup information before backup
[barman@barman-server ~]$ barman switch-xlog --force --archive employees4ssh
[barman@barman-server ~]$ barman list-backup employees4ssh
employees4ssh 20240612T143538 - Wed Jun 12 14:35:48 2024 - Size: 1.2 GiB - WAL Size: 80.7 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
[barman@barman-server ~]$ barman switch-xlog --force --archive employees4ssh
[barman@barman-server ~]$ barman list-backup employees4ssh
employees4ssh 20240612T143538 - Wed Jun 12 14:35:48 2024 - Size: 1.2 GiB - WAL Size: 80.7 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
Backup incremental
[barman@barman-server ~]$ barman
backup --reuse-backup=link employees4ssh
Starting backup using rsync-concurrent method for server employees4ssh in /barman/backup/employees4ssh/base/20240612T144406
Backup start at LSN: 0/93000028 (000000010000000000000093, 00000028)
Starting backup copy via rsync/SSH for 20240612T144406 (4 jobs)
Copy done (time: 1 second)
Asking PostgreSQL server to finalize the backup.
Backup size: 861.5 MiB. Actual size on disk: 2.5 MiB (-99.71% deduplication ratio).
Backup end at LSN: 0/93000100 (000000010000000000000093, 00000100)
Backup completed (start time: 2024-06-12 14:44:06.296904, elapsed time: 7 seconds)
Processing xlog segments from file archival for employees4ssh
000000010000000000000092
000000010000000000000093
000000010000000000000093.00000028.backup
Starting backup using rsync-concurrent method for server employees4ssh in /barman/backup/employees4ssh/base/20240612T144406
Backup start at LSN: 0/93000028 (000000010000000000000093, 00000028)
Starting backup copy via rsync/SSH for 20240612T144406 (4 jobs)
Copy done (time: 1 second)
Asking PostgreSQL server to finalize the backup.
Backup size: 861.5 MiB. Actual size on disk: 2.5 MiB (-99.71% deduplication ratio).
Backup end at LSN: 0/93000100 (000000010000000000000093, 00000100)
Backup completed (start time: 2024-06-12 14:44:06.296904, elapsed time: 7 seconds)
Processing xlog segments from file archival for employees4ssh
000000010000000000000092
000000010000000000000093
000000010000000000000093.00000028.backup
[barman@barman-server ~]$ barman
list-backup employees4ssh
employees4ssh 20240612T144406 - Wed Jun 12 14:44:09 2024 - Size: 861.5 MiB - WAL Size: 0 B (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240612T143538 - Wed Jun 12 14:35:48 2024 - Size: 1.2 GiB - WAL Size: 112.8 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240612T144406 - Wed Jun 12 14:44:09 2024 - Size: 861.5 MiB - WAL Size: 0 B (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240612T143538 - Wed Jun 12 14:35:48 2024 - Size: 1.2 GiB - WAL Size: 112.8 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
[barman@barman-server ~]$ barman
show-backup employees4ssh 20240612T144406
Backup 20240612T144406:
Server Name : employees4ssh
System Id : 7377775620992307471
Status : DONE
PostgreSQL Version : 160003
PGDATA directory : /u01/edb/as16/data
Tablespaces:
tbs_ihrp_data : /u01/ihrp/data (oid: 16385)
tbs_ihrp_index : /u01/ihrp/index (oid: 16386)
Base backup
information:
Disk usage : 861.5 MiB (861.5 MiB with WALs)
Incremental size : 2.5 MiB (-99.71%)
Timeline : 1
Begin WAL : 000000010000000000000093
End WAL : 000000010000000000000093
WAL number : 1
WAL compression ratio: 99.90%
Begin time : 2024-06-12 14:44:05.802599+07:00
End time : 2024-06-12 14:44:09.241096+07:00
Copy time : 1 second + 2 seconds startup
Estimated throughput : 2.5 MiB/s (4 jobs)
Begin Offset : 40
End Offset : 256
Begin LSN : 0/93000028
End LSN : 0/93000100
WAL information:
No of files : 0
Disk usage : 0 B
Last available : 000000010000000000000093
Catalog information:
Retention Policy : not enforced
Previous Backup : 20240612T143538
Next Backup : - (this is the latest base backup)
Backup 20240612T144406:
Server Name : employees4ssh
System Id : 7377775620992307471
Status : DONE
PostgreSQL Version : 160003
PGDATA directory : /u01/edb/as16/data
tbs_ihrp_data : /u01/ihrp/data (oid: 16385)
tbs_ihrp_index : /u01/ihrp/index (oid: 16386)
Disk usage : 861.5 MiB (861.5 MiB with WALs)
Incremental size : 2.5 MiB (-99.71%)
Timeline : 1
Begin WAL : 000000010000000000000093
End WAL : 000000010000000000000093
WAL number : 1
WAL compression ratio: 99.90%
Begin time : 2024-06-12 14:44:05.802599+07:00
End time : 2024-06-12 14:44:09.241096+07:00
Copy time : 1 second + 2 seconds startup
Estimated throughput : 2.5 MiB/s (4 jobs)
Begin Offset : 40
End Offset : 256
Begin LSN : 0/93000028
End LSN : 0/93000100
No of files : 0
Disk usage : 0 B
Last available : 000000010000000000000093
Retention Policy : not enforced
Previous Backup : 20240612T143538
Next Backup : - (this is the latest base backup)
Change data in Database server
- Create /Drop tables, indexes
- Insert/Delete/Truncate tables
- Create /Drop tables, indexes
- Insert/Delete/Truncate tables
Check backup information
[barman@barman-server ~]$ barman
switch-xlog --force --archive employees4ssh
The WAL file 00000001000000000000009D has been closed on server 'employees4ssh'
Waiting for the WAL file 00000001000000000000009D from server 'employees4ssh' (max: 30 seconds)
Processing xlog segments from file archival for employees4ssh
000000010000000000000098
000000010000000000000099
00000001000000000000009A
00000001000000000000009B
00000001000000000000009C
Processing xlog segments from file archival for employees4ssh
00000001000000000000009D
The WAL file 00000001000000000000009D has been closed on server 'employees4ssh'
Waiting for the WAL file 00000001000000000000009D from server 'employees4ssh' (max: 30 seconds)
Processing xlog segments from file archival for employees4ssh
000000010000000000000098
000000010000000000000099
00000001000000000000009A
00000001000000000000009B
00000001000000000000009C
Processing xlog segments from file archival for employees4ssh
00000001000000000000009D
[barman@barman-server ~]$ barman
list-backup employees4ssh
employees4ssh 20240612T144406 - Wed Jun 12 14:44:09 2024 - Size: 861.5 MiB - WAL Size: 47.8 MiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240612T143538 - Wed Jun 12 14:35:48 2024 - Size: 1.2 GiB - WAL Size: 112.8 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240612T144406 - Wed Jun 12 14:44:09 2024 - Size: 861.5 MiB - WAL Size: 47.8 MiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240612T143538 - Wed Jun 12 14:35:48 2024 - Size: 1.2 GiB - WAL Size: 112.8 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
[root@barman-server ~]# du -hs
/barman/backup/employees4ssh/wals/
49M /barman/backup/employees4ssh/wals/
49M /barman/backup/employees4ssh/wals/
Backup incremental
[barman@barman-server ~]$ barman
backup --reuse-backup=link employees4ssh
Starting backup using rsync-concurrent method for server employees4ssh in /barman/backup/employees4ssh/base/20240612T145529
Backup start at LSN: 0/9F000028 (00000001000000000000009F, 00000028)
Starting backup copy via rsync/SSH for 20240612T145529 (4 jobs)
Copy done (time: 1 second)
Asking PostgreSQL server to finalize the backup.
Backup size: 959.2 MiB. Actual size on disk: 102.2 MiB (-89.34% deduplication ratio).
Backup end at LSN: 0/9F000100 (00000001000000000000009F, 00000100)
Backup completed (start time: 2024-06-12 14:55:29.848980, elapsed time: 7 seconds)
Processing xlog segments from file archival for employees4ssh
00000001000000000000009E
00000001000000000000009F
00000001000000000000009F.00000028.backup
Starting backup using rsync-concurrent method for server employees4ssh in /barman/backup/employees4ssh/base/20240612T145529
Backup start at LSN: 0/9F000028 (00000001000000000000009F, 00000028)
Starting backup copy via rsync/SSH for 20240612T145529 (4 jobs)
Copy done (time: 1 second)
Asking PostgreSQL server to finalize the backup.
Backup size: 959.2 MiB. Actual size on disk: 102.2 MiB (-89.34% deduplication ratio).
Backup end at LSN: 0/9F000100 (00000001000000000000009F, 00000100)
Backup completed (start time: 2024-06-12 14:55:29.848980, elapsed time: 7 seconds)
Processing xlog segments from file archival for employees4ssh
00000001000000000000009E
00000001000000000000009F
00000001000000000000009F.00000028.backup
[barman@barman-server ~]$ barman
list-backup employees4ssh
employees4ssh 20240612T145529 - Wed Jun 12 14:55:33 2024 - Size: 959.3 MiB - WAL Size: 0 B (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240612T144406 - Wed Jun 12 14:44:09 2024 - Size: 861.5 MiB - WAL Size: 48.0 MiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240612T143538 - Wed Jun 12 14:35:48 2024 - Size: 1.2 GiB - WAL Size: 112.8 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240612T145529 - Wed Jun 12 14:55:33 2024 - Size: 959.3 MiB - WAL Size: 0 B (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240612T144406 - Wed Jun 12 14:44:09 2024 - Size: 861.5 MiB - WAL Size: 48.0 MiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240612T143538 - Wed Jun 12 14:35:48 2024 - Size: 1.2 GiB - WAL Size: 112.8 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
[barman@barman-server ~]$ barman
show-backup employees4ssh 20240612T145529
Backup 20240612T145529:
Server Name : employees4ssh
System Id : 7377775620992307471
Status : DONE
PostgreSQL Version : 160003
PGDATA directory : /u01/edb/as16/data
Tablespaces:
tbs_ihrp_data : /u01/ihrp/data (oid: 16385)
tbs_ihrp_index : /u01/ihrp/index (oid: 16386)
Base backup
information:
Disk usage : 959.2 MiB (959.3 MiB with WALs)
Incremental size : 102.2 MiB (-89.34%)
Timeline : 1
Begin WAL : 00000001000000000000009F
End WAL : 00000001000000000000009F
WAL number : 1
WAL compression ratio: 99.90%
Begin time : 2024-06-12 14:55:29.235736+07:00
End time : 2024-06-12 14:55:33.510901+07:00
Copy time : 1 second + 2 seconds startup
Estimated throughput : 62.0 MiB/s (4 jobs)
Begin Offset : 40
End Offset : 256
Begin LSN : 0/9F000028
End LSN : 0/9F000100
WAL information:
No of files : 0
Disk usage : 0 B
Last available : 00000001000000000000009F
Catalog information:
Retention Policy : not enforced
Previous Backup : 20240612T144406
Next Backup : - (this is the latest base backup)
Backup 20240612T145529:
Server Name : employees4ssh
System Id : 7377775620992307471
Status : DONE
PostgreSQL Version : 160003
PGDATA directory : /u01/edb/as16/data
tbs_ihrp_data : /u01/ihrp/data (oid: 16385)
tbs_ihrp_index : /u01/ihrp/index (oid: 16386)
Disk usage : 959.2 MiB (959.3 MiB with WALs)
Incremental size : 102.2 MiB (-89.34%)
Timeline : 1
Begin WAL : 00000001000000000000009F
End WAL : 00000001000000000000009F
WAL number : 1
WAL compression ratio: 99.90%
Begin time : 2024-06-12 14:55:29.235736+07:00
End time : 2024-06-12 14:55:33.510901+07:00
Copy time : 1 second + 2 seconds startup
Estimated throughput : 62.0 MiB/s (4 jobs)
Begin Offset : 40
End Offset : 256
Begin LSN : 0/9F000028
End LSN : 0/9F000100
No of files : 0
Disk usage : 0 B
Last available : 00000001000000000000009F
Retention Policy : not enforced
Previous Backup : 20240612T144406
Next Backup : - (this is the latest base backup)
Note:- WAL information must be check careful in each backup.
- Do not delete any backup files, wal files manually. Using retention policy to execute that.
- On barman server, if set retention_policy = REDUNDANCY 3,
- Barman always maintains 3 backups. And new backup full will automatically be created from current backup full with the next incremental backup.
- Expired Wal files on Database server will be deleted automatically, and marked be backup
- Using this process to verify:
[barman@barman-server ~]$ barman
list-backup employees4ssh
employees4ssh 20240613T095623 - Thu Jun 13 09:56:26 2024 -
Size: 861.6 MiB - WAL Size: 0 B (tablespaces: tbs_ihrp_data:/u01/ihrp/data,
tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240613T094946 - Thu Jun 13 09:49:49 2024 -
Size: 1.1 GiB - WAL Size: 102.3 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data,
tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240612T154526 - Wed Jun 12 15:45:28 2024 -
Size: 1.1 GiB - WAL Size: 48.3 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data,
tbs_ihrp_index:/u01/ihrp/index)
[barman@barman-server base]$ ls -ltr
total 0
drwxr-xr-x. 5 barman barman 63 Jun 12 15:45 20240612T154526
drwxr-xr-x. 5 barman barman 63 Jun 13 09:49 20240613T094946
drwxr-xr-x. 5 barman barman 63 Jun 13 09:56 20240613T095623
[barman@barman-server base]$ du -hs
*
1.1G
20240612T154526
116K 20240613T094946
2.8M
20240613T095623
Change data
employees=> create table employees.temp01 tablespace
tbs_ihrp_data as select * from employees.employee ;
SELECT 300024
employees=> create table employees.temp02 tablespace
tbs_ihrp_data as select * from employees.employee ;
SELECT 300024
[barman@barman-server ~]$ barman
switch-xlog --force --archive employees4ssh
The WAL file 0000000100000000000000C6 has been closed on
server 'employees4ssh'
Waiting for the WAL file 0000000100000000000000C6 from
server 'employees4ssh' (max: 30 seconds)
Processing xlog segments from file archival for
employees4ssh
0000000100000000000000C3
0000000100000000000000C4
0000000100000000000000C5
Processing xlog segments from file archival for
employees4ssh
0000000100000000000000C6
[barman@barman-server ~]$ barman
list-backup employees4ssh
employees4ssh 20240613T095623 - Thu Jun 13 09:56:26 2024 -
Size: 861.6 MiB - WAL Size: 19.1 MiB (tablespaces:
tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240613T094946 - Thu Jun 13 09:49:49 2024 -
Size: 1.1 GiB - WAL Size: 102.3 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data,
tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240612T154526 - Wed Jun 12 15:45:28 2024 -
Size: 1.1 GiB - WAL Size: 48.3 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data,
tbs_ihrp_index:/u01/ihrp/index)
[enterprisedb@edb-saigon pg_wal]$ ls
-ltr
total 98316
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13
09:56 0000000100000000000000C8
-rw-------. 1 enterprisedb enterprisedb 359 Jun 13 09:56
0000000100000000000000C2.00000028.backup
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13
10:01 0000000100000000000000C9
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13
10:01 0000000100000000000000CA
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13
10:01 0000000100000000000000CB
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13
10:01 0000000100000000000000C6
drwx------. 2 enterprisedb enterprisedb 4096 Jun 13 10:01 archive_status
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13
10:01 0000000100000000000000C7
[barman@barman-server ~]$ barman
backup --reuse-backup=link employees4ssh
Starting backup using rsync-concurrent method for server
employees4ssh in /barman/backup/employees4ssh/base/20240613T100329
Backup start at LSN: 0/C8000028 (0000000100000000000000C8,
00000028)
Starting backup copy via rsync/SSH for 20240613T100329 (4
jobs)
Copy done (time: 1 second)
Asking PostgreSQL server to finalize the backup.
Backup size: 900.7 MiB. Actual size on disk: 43.2 MiB
(-95.20% deduplication ratio).
Backup end at LSN: 0/C8000138 (0000000100000000000000C8,
00000138)
Backup completed (start time: 2024-06-13 10:03:29.728567,
elapsed time: 6 seconds)
Processing xlog segments from file archival for
employees4ssh
0000000100000000000000C7
0000000100000000000000C8
0000000100000000000000C8.00000028.backup
[barman@barman-server ~]$ barman
list-backup employees4ssh
employees4ssh 20240613T100329 - Thu Jun 13 10:03:32 2024 -
Size: 900.7 MiB - WAL Size: 0 B (tablespaces: tbs_ihrp_data:/u01/ihrp/data,
tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240613T095623 - Thu Jun 13 09:56:26 2024 -
Size: 861.6 MiB - WAL Size: 19.2 MiB (tablespaces:
tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240613T094946 - Thu Jun 13 09:49:49 2024 -
Size: 1.1 GiB - WAL Size: 102.3 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data,
tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240612T154526 - Wed Jun 12 15:45:28 2024 -
Size: 1.1 GiB - WAL Size: 48.3 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data,
tbs_ihrp_index:/u01/ihrp/index) - OBSOLETE
After few seconds, execute:
[barman@barman-server ~]$ barman list-backup
employees4ssh
employees4ssh 20240613T100329 - Thu Jun 13 10:03:32 2024 -
Size: 900.7 MiB - WAL Size: 0 B (tablespaces: tbs_ihrp_data:/u01/ihrp/data,
tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240613T095623 - Thu Jun 13 09:56:26 2024 -
Size: 861.6 MiB - WAL Size: 19.2 MiB (tablespaces:
tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240613T094946 - Thu Jun 13 09:49:49 2024 -
Size: 1.1 GiB - WAL Size: 102.3 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data,
tbs_ihrp_index:/u01/ihrp/index)
[barman@barman-server base]$ ls -ltr
total 0
drwxr-xr-x. 5 barman barman 63 Jun 13 09:49 20240613T094946
drwxr-xr-x. 5 barman barman 63 Jun 13 09:56 20240613T095623
drwxr-xr-x. 5 barman barman 63 Jun 13 10:03 20240613T100329
[barman@barman-server base]$ du -hs
*
1.1G 20240613T094946
2.8M
20240613T095623
44M
20240613T100329
[enterprisedb@edb-saigon pg_wal]$ ls
-ltr
total 98320
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13
10:01 0000000100000000000000CA
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13
10:01 0000000100000000000000CB
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13
10:01 0000000100000000000000CC
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13
10:03 0000000100000000000000C7
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13
10:03 0000000100000000000000C8
-rw-------. 1 enterprisedb enterprisedb 359 Jun 13 10:03
0000000100000000000000C8.00000028.backup
drwx------. 2 enterprisedb enterprisedb 8192 Jun 13 10:03 archive_status
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13
10:03 0000000100000000000000C9
4. COPY BACKUP SET TO TAPE & RESTORE EXPIRED BACKUP SET
Because of organization's policy, we must keep backup sets a long time, maybe 5 years. So we must copy the oldest backup set to tape or staging area before it is expired.
Configuration in [barman] section- minimum_redundancy = 2
- retention_policy = REDUNDANCY 3
[barman@barman-server ~]$ barman list-backup employees4ssh employees4ssh 20240628T122244 - Fri Jun 28 12:22:53 2024 - Size: 988.7 MiB - WAL Size: 16.2 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)employees4ssh 20240628T122110 - Fri Jun 28 12:21:20 2024 - Size: 988.7 MiB - WAL Size: 32.2 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)employees4ssh 20240614T102031 - Fri Jun 14 10:20:40 2024 - Size: 979.0 MiB - WAL Size: 32.2 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
[root@barman-server ~]# tree -L 4 /barman/backup//barman/backup/├── cfg_changes.queue├── employees4ssh│ ├── base│ │ ├── 20240614T102031│ │ │ ├── 16385│ │ │ ├── 16386│ │ │ ├── backup.info│ │ │ └── data│ │ ├── 20240628T122110│ │ │ ├── 16385│ │ │ ├── 16386│ │ │ ├── backup.info│ │ │ └── data│ │ └── 20240628T122244│ │ ├── 16385│ │ ├── 16386│ │ ├── backup.info│ │ └── data│ ├── errors│ ├── identity.json│ ├── incoming│ ├── streaming│ └── wals│ ├── 0000000100000001│ │ ├── 000000010000000100000014│ │ ├── 000000010000000100000014.00000028.backup│ │ ├── 000000010000000100000042│ │ ├── 000000010000000100000043│ │ ├── 000000010000000100000043.00000028.backup│ │ ├── 000000010000000100000044│ │ ├── 000000010000000100000045│ │ ├── 000000010000000100000045.00000028.backup│ │ └── 000000010000000100000046│ └── xlog.db
Because of retaining only 3 full backup sets, so we need copy the oldest backup set in /base, such as (20240614T102031) plus wals to tape before the next full backup.
When restoring the expired backup set to new server, we must configure right path of backup location in /etc/barman.conf. - Retrieve the backup files (typically the entire backup directory) from tape to a local directory.
- Ensure the backup directory structure ('base', 'wals', etc.) is intact.
- Use barman recover restore command to restore the backup to the new server.
- Barman always maintains 3 backups. And new backup full will automatically be created from current backup full with the next incremental backup.
- Expired Wal files on Database server will be deleted automatically, and marked be backup
- Using this process to verify:
employees4ssh 20240613T095623 - Thu Jun 13 09:56:26 2024 -
Size: 861.6 MiB - WAL Size: 0 B (tablespaces: tbs_ihrp_data:/u01/ihrp/data,
tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240613T094946 - Thu Jun 13 09:49:49 2024 - Size: 1.1 GiB - WAL Size: 102.3 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240612T154526 - Wed Jun 12 15:45:28 2024 - Size: 1.1 GiB - WAL Size: 48.3 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240613T094946 - Thu Jun 13 09:49:49 2024 - Size: 1.1 GiB - WAL Size: 102.3 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240612T154526 - Wed Jun 12 15:45:28 2024 - Size: 1.1 GiB - WAL Size: 48.3 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
[barman@barman-server base]$ ls -ltr
total 0
drwxr-xr-x. 5 barman barman 63 Jun 12 15:45 20240612T154526
drwxr-xr-x. 5 barman barman 63 Jun 13 09:49 20240613T094946
drwxr-xr-x. 5 barman barman 63 Jun 13 09:56 20240613T095623
total 0
drwxr-xr-x. 5 barman barman 63 Jun 12 15:45 20240612T154526
drwxr-xr-x. 5 barman barman 63 Jun 13 09:49 20240613T094946
drwxr-xr-x. 5 barman barman 63 Jun 13 09:56 20240613T095623
[barman@barman-server base]$ du -hs
*
1.1G 20240612T154526
116K 20240613T094946
2.8M 20240613T095623
1.1G 20240612T154526
116K 20240613T094946
2.8M 20240613T095623
Change data
employees=> create table employees.temp01 tablespace tbs_ihrp_data as select * from employees.employee ;
SELECT 300024
employees=> create table employees.temp02 tablespace tbs_ihrp_data as select * from employees.employee ;
SELECT 300024
employees=> create table employees.temp01 tablespace tbs_ihrp_data as select * from employees.employee ;
SELECT 300024
employees=> create table employees.temp02 tablespace tbs_ihrp_data as select * from employees.employee ;
SELECT 300024
[barman@barman-server ~]$ barman
switch-xlog --force --archive employees4ssh
The WAL file 0000000100000000000000C6 has been closed on server 'employees4ssh'
Waiting for the WAL file 0000000100000000000000C6 from server 'employees4ssh' (max: 30 seconds)
Processing xlog segments from file archival for employees4ssh
0000000100000000000000C3
0000000100000000000000C4
0000000100000000000000C5
Processing xlog segments from file archival for employees4ssh
0000000100000000000000C6
The WAL file 0000000100000000000000C6 has been closed on server 'employees4ssh'
Waiting for the WAL file 0000000100000000000000C6 from server 'employees4ssh' (max: 30 seconds)
Processing xlog segments from file archival for employees4ssh
0000000100000000000000C3
0000000100000000000000C4
0000000100000000000000C5
Processing xlog segments from file archival for employees4ssh
0000000100000000000000C6
[barman@barman-server ~]$ barman
list-backup employees4ssh
employees4ssh 20240613T095623 - Thu Jun 13 09:56:26 2024 - Size: 861.6 MiB - WAL Size: 19.1 MiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240613T094946 - Thu Jun 13 09:49:49 2024 - Size: 1.1 GiB - WAL Size: 102.3 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240612T154526 - Wed Jun 12 15:45:28 2024 - Size: 1.1 GiB - WAL Size: 48.3 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240613T095623 - Thu Jun 13 09:56:26 2024 - Size: 861.6 MiB - WAL Size: 19.1 MiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240613T094946 - Thu Jun 13 09:49:49 2024 - Size: 1.1 GiB - WAL Size: 102.3 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240612T154526 - Wed Jun 12 15:45:28 2024 - Size: 1.1 GiB - WAL Size: 48.3 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
[enterprisedb@edb-saigon pg_wal]$ ls
-ltr
total 98316
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13 09:56 0000000100000000000000C8
-rw-------. 1 enterprisedb enterprisedb 359 Jun 13 09:56 0000000100000000000000C2.00000028.backup
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13 10:01 0000000100000000000000C9
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13 10:01 0000000100000000000000CA
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13 10:01 0000000100000000000000CB
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13 10:01 0000000100000000000000C6
drwx------. 2 enterprisedb enterprisedb 4096 Jun 13 10:01 archive_status
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13 10:01 0000000100000000000000C7
total 98316
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13 09:56 0000000100000000000000C8
-rw-------. 1 enterprisedb enterprisedb 359 Jun 13 09:56 0000000100000000000000C2.00000028.backup
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13 10:01 0000000100000000000000C9
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13 10:01 0000000100000000000000CA
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13 10:01 0000000100000000000000CB
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13 10:01 0000000100000000000000C6
drwx------. 2 enterprisedb enterprisedb 4096 Jun 13 10:01 archive_status
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13 10:01 0000000100000000000000C7
[barman@barman-server ~]$ barman
backup --reuse-backup=link employees4ssh
Starting backup using rsync-concurrent method for server employees4ssh in /barman/backup/employees4ssh/base/20240613T100329
Backup start at LSN: 0/C8000028 (0000000100000000000000C8, 00000028)
Starting backup copy via rsync/SSH for 20240613T100329 (4 jobs)
Copy done (time: 1 second)
Asking PostgreSQL server to finalize the backup.
Backup size: 900.7 MiB. Actual size on disk: 43.2 MiB (-95.20% deduplication ratio).
Backup end at LSN: 0/C8000138 (0000000100000000000000C8, 00000138)
Backup completed (start time: 2024-06-13 10:03:29.728567, elapsed time: 6 seconds)
Processing xlog segments from file archival for employees4ssh
0000000100000000000000C7
0000000100000000000000C8
0000000100000000000000C8.00000028.backup
Starting backup using rsync-concurrent method for server employees4ssh in /barman/backup/employees4ssh/base/20240613T100329
Backup start at LSN: 0/C8000028 (0000000100000000000000C8, 00000028)
Starting backup copy via rsync/SSH for 20240613T100329 (4 jobs)
Copy done (time: 1 second)
Asking PostgreSQL server to finalize the backup.
Backup size: 900.7 MiB. Actual size on disk: 43.2 MiB (-95.20% deduplication ratio).
Backup end at LSN: 0/C8000138 (0000000100000000000000C8, 00000138)
Backup completed (start time: 2024-06-13 10:03:29.728567, elapsed time: 6 seconds)
Processing xlog segments from file archival for employees4ssh
0000000100000000000000C7
0000000100000000000000C8
0000000100000000000000C8.00000028.backup
[barman@barman-server ~]$ barman
list-backup employees4ssh
employees4ssh 20240613T100329 - Thu Jun 13 10:03:32 2024 - Size: 900.7 MiB - WAL Size: 0 B (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240613T095623 - Thu Jun 13 09:56:26 2024 - Size: 861.6 MiB - WAL Size: 19.2 MiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240613T094946 - Thu Jun 13 09:49:49 2024 - Size: 1.1 GiB - WAL Size: 102.3 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240612T154526 - Wed Jun 12 15:45:28 2024 - Size: 1.1 GiB - WAL Size: 48.3 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index) - OBSOLETE
employees4ssh 20240613T100329 - Thu Jun 13 10:03:32 2024 - Size: 900.7 MiB - WAL Size: 0 B (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240613T095623 - Thu Jun 13 09:56:26 2024 - Size: 861.6 MiB - WAL Size: 19.2 MiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240613T094946 - Thu Jun 13 09:49:49 2024 - Size: 1.1 GiB - WAL Size: 102.3 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240612T154526 - Wed Jun 12 15:45:28 2024 - Size: 1.1 GiB - WAL Size: 48.3 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index) - OBSOLETE
After few seconds, execute:
[barman@barman-server ~]$ barman list-backup
employees4ssh
employees4ssh 20240613T100329 - Thu Jun 13 10:03:32 2024 - Size: 900.7 MiB - WAL Size: 0 B (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240613T095623 - Thu Jun 13 09:56:26 2024 - Size: 861.6 MiB - WAL Size: 19.2 MiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240613T094946 - Thu Jun 13 09:49:49 2024 - Size: 1.1 GiB - WAL Size: 102.3 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240613T100329 - Thu Jun 13 10:03:32 2024 - Size: 900.7 MiB - WAL Size: 0 B (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240613T095623 - Thu Jun 13 09:56:26 2024 - Size: 861.6 MiB - WAL Size: 19.2 MiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240613T094946 - Thu Jun 13 09:49:49 2024 - Size: 1.1 GiB - WAL Size: 102.3 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
[barman@barman-server base]$ ls -ltr
total 0
drwxr-xr-x. 5 barman barman 63 Jun 13 09:49 20240613T094946
drwxr-xr-x. 5 barman barman 63 Jun 13 09:56 20240613T095623
drwxr-xr-x. 5 barman barman 63 Jun 13 10:03 20240613T100329
total 0
drwxr-xr-x. 5 barman barman 63 Jun 13 09:49 20240613T094946
drwxr-xr-x. 5 barman barman 63 Jun 13 09:56 20240613T095623
drwxr-xr-x. 5 barman barman 63 Jun 13 10:03 20240613T100329
[barman@barman-server base]$ du -hs
*
1.1G 20240613T094946
2.8M 20240613T095623
44M 20240613T100329
1.1G 20240613T094946
2.8M 20240613T095623
44M 20240613T100329
[enterprisedb@edb-saigon pg_wal]$ ls
-ltr
total 98320
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13 10:01 0000000100000000000000CA
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13 10:01 0000000100000000000000CB
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13 10:01 0000000100000000000000CC
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13 10:03 0000000100000000000000C7
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13 10:03 0000000100000000000000C8
-rw-------. 1 enterprisedb enterprisedb 359 Jun 13 10:03 0000000100000000000000C8.00000028.backup
drwx------. 2 enterprisedb enterprisedb 8192 Jun 13 10:03 archive_status
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13 10:03 0000000100000000000000C9
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13 10:01 0000000100000000000000CA
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13 10:01 0000000100000000000000CB
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13 10:01 0000000100000000000000CC
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13 10:03 0000000100000000000000C7
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13 10:03 0000000100000000000000C8
-rw-------. 1 enterprisedb enterprisedb 359 Jun 13 10:03 0000000100000000000000C8.00000028.backup
drwx------. 2 enterprisedb enterprisedb 8192 Jun 13 10:03 archive_status
-rw-------. 1 enterprisedb enterprisedb 16777216 Jun 13 10:03 0000000100000000000000C9
4. COPY BACKUP SET TO TAPE & RESTORE EXPIRED BACKUP SET
Because of organization's policy, we must keep backup sets a long time, maybe 5 years. So we must copy the oldest backup set to tape or staging area before it is expired.
Configuration in [barman] section
- minimum_redundancy = 2
- retention_policy = REDUNDANCY 3
[barman@barman-server ~]$ barman list-backup employees4ssh
employees4ssh 20240628T122244 - Fri Jun 28 12:22:53 2024 - Size: 988.7 MiB - WAL Size: 16.2 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240628T122110 - Fri Jun 28 12:21:20 2024 - Size: 988.7 MiB - WAL Size: 32.2 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
employees4ssh 20240614T102031 - Fri Jun 14 10:20:40 2024 - Size: 979.0 MiB - WAL Size: 32.2 KiB (tablespaces: tbs_ihrp_data:/u01/ihrp/data, tbs_ihrp_index:/u01/ihrp/index)
[root@barman-server ~]# tree -L 4 /barman/backup/
/barman/backup/
├── cfg_changes.queue
├── employees4ssh
│ ├── base
│ │ ├── 20240614T102031
│ │ │ ├── 16385
│ │ │ ├── 16386
│ │ │ ├── backup.info
│ │ │ └── data
│ │ ├── 20240628T122110
│ │ │ ├── 16385
│ │ │ ├── 16386
│ │ │ ├── backup.info
│ │ │ └── data
│ │ └── 20240628T122244
│ │ ├── 16385
│ │ ├── 16386
│ │ ├── backup.info
│ │ └── data
│ ├── errors
│ ├── identity.json
│ ├── incoming
│ ├── streaming
│ └── wals
│ ├── 0000000100000001
│ │ ├── 000000010000000100000014
│ │ ├── 000000010000000100000014.00000028.backup
│ │ ├── 000000010000000100000042
│ │ ├── 000000010000000100000043
│ │ ├── 000000010000000100000043.00000028.backup
│ │ ├── 000000010000000100000044
│ │ ├── 000000010000000100000045
│ │ ├── 000000010000000100000045.00000028.backup
│ │ └── 000000010000000100000046
│ └── xlog.db
Because of retaining only 3 full backup sets, so we need copy the oldest backup set in /base, such as (20240614T102031) plus wals to tape before the next full backup.
When restoring the expired backup set to new server, we must configure right path of backup location in /etc/barman.conf.
- Retrieve the backup files (typically the entire backup directory) from tape to a local directory.
- Ensure the backup directory structure ('base', 'wals', etc.) is intact.
- Use barman recover restore command to restore the backup to the new server.