Test environment Description
Os:centos Linux release 7.3.1611 (Core) X64
PG:PG10 beta3 Source Install
pg_probackup:2.0.3 Source Install
Create an archive backup directory
[Email protected] ~]# Mkdir/backupdir
[Email protected] ~]# chown postgres.postgres-r/backupdir
Database parameter Configuration
# # #-Archiving-# # #
Archive_mode = On
Archive_command = ' pg_probackup archive-push-b/backupdir--instance pg10--wal-file-path%p--wal-file-name%f '
# # # Default # #
Max_wal_senders = 10
Hot_standby = On
Full_page_writes = On
Initializing the backup directory
[Email protected] ~]# Su-postgres
[Email protected] ~]$ pg_probackup init-b/backupdir
Info:backup Catalog '/backupdir ' successfully inited
Add Backup Instance Directory
[Email protected] ~]$ pg_probackup add-instance-b/backupdir-d/pgdata10/--instance pg10
Info:instance ' pg10 ' successfully inited
Show Backup instance Configuration
[Email protected] ~]$ pg_probackup show-config-b/backupdir--instance pg10
#Backup Instance Info
PGDATA =/pgdata10/
System-identifier = 6460633300993501667
#Connection Parameters:
Pgdatabase = Postgres
#Replica Parameters:
#Logging Parameters:
#Retention Parameters:
#Compression Parameters:
Compress-algorithm = None
Compress-level = 6
[Email protected] ~]$ pg_probackup backup-b/backupdir-b full--instance pg10
Info:wait for Pg_stop_backup ()
Info:backup OVKYC7 Completed
[Email protected] ~]$
Incremental backup
[Email protected] ~]$ pg_probackup backup-b/backupdir-b PAGE--instance pg10
Info:wait for LSN 0/4000028 in archived WAL segment/backupdir/wal/pg10/000000010000000000000004
Info:wait for Pg_stop_backup ()
Info:backup Ovkyme Completed
[Email protected] ~]$
Show backup
[Email protected] ~]$ pg_probackup show-b/backupdir
BACKUP INSTANCE ' pg10 '
=============================================================================================================== ================
Instance ID Recovery time Mode WAL current/parent TLI time Data Start LSN Stop LSN St ATUs
=============================================================================================================== ================
Pg10 ovkyme 2017-09-01 10:51:56 PAGE ARCHIVE 1/0 8s 4407kB 0/4000028 0/50000f0 OK
PG10 OVKYC7 2017-09-01 10:45:57 full ARCHIVE 1/0 17s 31MB 0/2000060 0/2000198 OK
[Email protected] ~]$
Verifying backups
[Email protected] ~]$ pg_probackup validate-b/backupdir--instance pg10
Info:validate backups of the instance ' pg10 '
Info:validate Backup Ovkyme
Info:backup Validation completed successfully
Info:validate Backup OVKYC7
Info:backup Validation completed successfully
Info:all backups is valid
[Email protected] ~]$
Restore Backup
[Email protected] pgdata10]$ pg_probackup restore-b/backupdir--instance pg10-d/pgdata10/
Info:backup Validation completed successfully
Configure retention Period
[Email protected] ~]$ pg_probackup set-config-b/backupdir--instance pg10--retention-redundancy 2--retention-window 7
[Email protected] ~]$ pg_probackup show-config-b/backupdir--instance pg10
#Backup Instance Info
PGDATA =/pgdata10/
System-identifier = 6460633300993501667
#Connection Parameters:
Pgdatabase = Postgres
#Replica Parameters:
#Logging Parameters:
#Retention Parameters:
Retention-redundancy = 2
Retention-window = 7
#Compression Parameters:
Compress-algorithm = None
Compress-level = 6
[Email protected] ~]$
Parallel backup
Full
[Email protected] ~]$ pg_probackup backup-b/backupdir--instance pg10-b full-j 4
Info:wait for Pg_stop_backup ()
Info:backup OVL360 Completed
[Email protected] ~]$
Incremental
[Email protected] ~]$ pg_probackup backup-b/backupdir--instance pg10-b page-j 6
Info:wait for LSN 0/b000028 in archived WAL segment/backupdir/wal/pg10/00000002000000000000000b
Info:wait for Pg_stop_backup ()
Info:backup OVL3BK Completed
[Email protected] ~]$
[Email protected] ~]$
[Email protected] ~]$ pg_probackup show-b/backupdir--instance pg10
=============================================================================================================== ================
Instance ID Recovery time Mode WAL current/parent TLI time Data Start LSN Stop LSN St ATUs
=============================================================================================================== ================
Pg10 ovl3bk 2017-09-01 12:33:24 PAGE ARCHIVE 2/1 6s 4417kB 0/b000028 0/c0000f0 OK
PG10 OVL360 2017-09-01 12:30:11 full ARCHIVE 2/1 13s 31MB 0/9000060 0/9000198 OK
Pg10 ovkyme 2017-09-01 10:51:56 PAGE ARCHIVE 1/0 8s 4407kB 0/4000028 0/50000f0 OK
PG10 OVKYC7 2017-09-01 10:45:57 full ARCHIVE 1/0 17s 31MB 0/2000060 0/2000198 OK
[Email protected] ~]$
Restore
[Email protected] ~]$ pg_probackup restore-b/backupdir--instance pg10-d/pgdata10/-j 6
Info:backup Validation completed successfully
Info:restore of backup OVL3BK completed.
[Email protected] ~]$ pg_probackup show-b/backupdir--instance pg10-d/pgdata10
=============================================================================================================== ================
Instance ID Recovery time Mode WAL current/parent TLI time Data Start LSN Stop LSN St ATUs
=============================================================================================================== ================
Pg10 ovl3bk 2017-09-01 12:33:24 PAGE ARCHIVE 2/1 6s 4417kB 0/b000028 0/c0000f0 OK
PG10 OVL360 2017-09-01 12:30:11 full ARCHIVE 2/1 13s 31MB 0/9000060 0/9000198 OK
Pg10 ovkyme 2017-09-01 10:51:56 PAGE ARCHIVE 1/0 8s 4407kB 0/4000028 0/50000f0 OK
PG10 OVKYC7 2017-09-01 10:45:57 full ARCHIVE 1/0 17s 31MB 0/2000060 0/2000198 OK
[Email protected] ~]$
This article is from the "Yiyi" blog, make sure to keep this source http://heyiyi.blog.51cto.com/205455/1961899
PostgreSQL 10 Database backup Pg_probackup Concise tutorial