Back up a datanode
If there are multiple datanodes to be backed up, this command needs to be executed separately. If the user wants to restore based on barrier points later, he needs to log in to any coordinator and create a barraier before backing up.
[antdb@localhost1 ~/barman]$ barman backup dm0
Starting backup using rsync-exclusive method for server dm0 in /home/antdb/barman/data/dm0/base/20190129T150740
Backup start at LSN: 0/1C000060 (000000010000000000000007, 00000060)
This is the first backup for server dm0
WAL segments preceding the current backup have been found:
000000010000000000000005 from server dm0 has been removed
Starting backup copy via rsync/SSH for 20190129T150740 (3 jobs)
Copy done (time: 2 seconds)
This is the first backup for server dm0
Asking PostgreSQL server to finalize the backup.
Backup size: 207.2 MiB. Actual size on disk: 207.2 MiB (-0.00% deduplication ratio).
Backup end at LSN: 0/1C000130 (000000010000000000000007, 00000130)
Backup completed (start time: 2019-01-29 15:07:41.584111, elapsed time: 3 seconds)
Processing xlog segments from file archival for dm0
000000010000000000000006
000000010000000000000007
000000010000000000000007.00000060.backup
View all backup data of a node
[antdb@localhost1 ~/barman]$ barman list-backup dm0
dm0 20190129T150740 mode: rsync-exclusive tar:None - Tue Jan 29 15:16:29 2019 - Size: 207.3 MiB - WAL Size: 0 B
View the details of a particular backup, where 20190129T150740 is the backup_id.
[antdb@localhost1 ~/barman]$ barman show-backup dm0 20190129T150740
Backup 20190129T150740:
Server Name : dm0
Status : DONE
PostgreSQL Version : 100004
PGDATA directory : /home/antdb/pgdata_xc/datanode/0
Base backup information:
Disk usage : 207.2 MiB (207.3 MiB with WALs)
Incremental size : 207.2 MiB (-0.00%)
Timeline : 1
Begin WAL : 000000010000000000000007
End WAL : 000000010000000000000007
WAL number : 1
WAL compression ratio: 99.89%
Begin time : 2019-01-29 15:16:25.814768+08:00
End time : 2019-01-29 15:16:29.837834+08:00
Copy time : 2 seconds
Estimated throughput : 86.0 MiB/s (3 jobs)
Begin Offset : 96
End Offset : 304
Begin LSN : 0/1C000060
End LSN : 0/1C000130
WAL information:
No of files : 0
Disk usage : 0 B
Last available : 000000010000000000000007
Catalog information:
Retention Policy : VALID
Previous Backup : - (this is the oldest base backup)
Next Backup : - (this is the latest base backup)
Delete a backup
Command:
barman cron
This command will delete the expired and redundant backups according to the backup retention policy in the configuration file.
For example:
[antdb@localhost1 ~]$ barman list-backup db1
db1 20170926T172835 - Tue Sep 26 17:30:07 2017 - Size: 410.6 MiB - WAL Size: 0 B
db1 20170926T172728 - Tue Sep 26 17:27:23 2017 - Size: 408.0 MiB - WAL Size: 3.0 MiB
db1 20170926T172446 - Tue Sep 26 17:24:23 2017 - Size: 411.1 MiB - WAL Size: 1.8 MiB - OBSOLETE
db1 20170926T172350 - Tue Sep 26 17:23:31 2017 - Size: 411.1 MiB - WAL Size: 1.3 MiB - OBSOLETE
[antdb@localhost1 ~]$ barman cron
Starting WAL archiving for server db1
Enforcing retention policy: removing backup 20170926T172350 for server db1
Deleting backup 20170926T172350 for server db1
Delete associated WAL segments:
0000000A0000000000000046
0000000A0000000000000046.00000028.backup
0000000A0000000000000047
00000001000000000000002B
00000002000000000000002B
Deleted backup 20170926T172350 (start time: Tue Sep 26 17:32:43 2017, elapsed time: less than one second)
Enforcing retention policy: removing backup 20170926T172446 for server db1
Deleting backup 20170926T172446 for server db1
Delete associated WAL segments:
0000000A0000000000000048
0000000A0000000000000048.00000028.backup
0000000A0000000000000049
Deleted backup 20170926T172446 (start time: Tue Sep 26 17:32:43 2017, elapsed time: less than one second)
[dang22@localhost1 ~]$ barman list-backup db1
db1 20170926T172835 - Tue Sep 26 17:30:07 2017 - Size: 410.6 MiB - WAL Size: 0 B
db1 20170926T172728 - Tue Sep 26 17:27:23 2017 - Size: 408.0 MiB - WAL Size: 3.0 MiB
Delete a backup
Command:
barman delete server_name backup_id
For example:
[antdb@localhost1 ~/barman/conf]$ barman delete db1 20190104T033001
Deleting backup 20190104T033001 for server db1
Delete associated WAL segments:
000000010000000000000014
...
Backup all nodes
There are many nodes involved in the cluster and it is recommended to operate through the barman-operate.shscript provided.
The execution of sh barman-operate.sh backup_all will initiate a backup operation on all master nodes. The coordinator and gtmcoord are relatively smaller, which means the backups will take less time, and the datanode will take more time. Check the backup progress of the nodes through the barman log.