@@ -1834,15 +1834,15 @@ Deprecated. Wait time for WAL segment streaming via replication, in seconds. By
18341834
18351835## Howto
18361836
1837- All exaples below assume the remote mode of operations via ` ssh ` . If you are planning to run backup and restore operation locally then step ` Setup passwordless SSH connection ` can be skipped and all ` --remote-* ` options can be ommited.
1837+ All examples below assume the remote mode of operations via ` ssh ` . If you are planning to run backup and restore operation locally then step ` Setup passwordless SSH connection ` can be skipped and all ` --remote-* ` options can be ommited.
18381838
18391839Examples are based on Ubuntu 18.04, PostgreSQL 11 and pg_probackup 2.2.0.
18401840
18411841backup_host - host with backup catalog.
18421842backupman - user on ` backup_host ` running all pg_probackup operations.
18431843/mnt/backups - directory on ` backup_host ` where backup catalog is stored.
18441844
1845- postgres_host - host with PostgreSQL cluster.
1845+ postgres-host - host with PostgreSQL cluster.
18461846postgres - user on ` postgres_host ` which run PostgreSQL cluster.
18471847/var/lib/postgresql/11/main - directory on ` postgres_host ` where PGDATA of PostgreSQL cluster is located.
18481848backup_db - database used for connection to PostgreSQL cluster.
@@ -1882,7 +1882,7 @@ GRANT EXECUTE ON FUNCTION pg_catalog.txid_snapshot_xmax(txid_snapshot) TO probac
18821882COMMIT;
18831883```
18841884
1885- 3 . Init backup catalog:
1885+ 3 . Init the backup catalog:
18861886```
18871887[backupman@backup_host]$ pg_probackup-11 init -B /mnt/backups
18881888INFO: Backup catalog '/mnt/backups' successfully inited
@@ -1897,45 +1897,112 @@ INFO: Instance 'node' successfully inited
189718975 . Take FULL backup:
18981898```
18991899[backupman@backup_host] pg_probackup-11 backup -B /mnt/backups --instance 'pg-11' -b FULL --stream --remote-host=postgres_host --remote-user=postgres -U probackup -d backupdb
1900- INFO: Backup start, pg_probackup version: 2.2.0, instance: node, backup ID: PZ4LFC , backup mode: FULL, wal mode: STREAM, remote: true, compress-algorithm: none, compress-level: 1
1900+ INFO: Backup start, pg_probackup version: 2.2.0, instance: node, backup ID: PZ7YK2 , backup mode: FULL, wal mode: STREAM, remote: true, compress-algorithm: none, compress-level: 1
19011901INFO: Start transferring data files
19021902INFO: Data files are transferred
19031903INFO: wait for pg_stop_backup()
19041904INFO: pg_stop backup() successfully executed
1905- INFO: Validating backup PZ4LFC
1906- INFO: Backup PZ4LFC data files are valid
1907- INFO: Backup PZ4LFC resident size: 62MB
1908- INFO: Backup PZ4LFC completed
1905+ INFO: Validating backup PZ7YK2
1906+ INFO: Backup PZ7YK2 data files are valid
1907+ INFO: Backup PZ7YK2 resident size: 196MB
1908+ INFO: Backup PZ7YK2 completed
19091909```
19101910
191119116 . Lets take a look at the backup catalog:
19121912```
1913+ [backupman@backup_host] pg_probackup-11 backup -B /mnt/backups --instance 'pg-11'
1914+
19131915BACKUP INSTANCE 'pg-11'
19141916==================================================================================================================================
19151917 Instance Version ID Recovery Time Mode WAL Mode TLI Time Data WAL Zratio Start LSN Stop LSN Status
19161918==================================================================================================================================
1917- node 11 PZ4LFC 2019-10-10 00:09:17 +03 FULL STREAM 1/0 7s 30MB 32MB 1.00 0/C000028 0/C000160 OK
1919+ node 11 PZ7YK2 2019-10-11 19:45:45 +03 FULL STREAM 1/0 11s 180MB 16MB 1.00 0/3C000028 0/3C000198 OK
19181920
19191921```
19201922
1921- 7 . Lets hide some options into config, so cmdline can be less crowdy :
1923+ 7 . Take incremental backup in DELTA mode :
19221924```
1923- [backupman@backup_host]$ pg_probackup-11 set-config -B /mnt/backups --instance pg-11 --remote-host=postgres_host --remote-user=postgres --pguser=probackup --pgdatabase=backupdb
1925+ [backupman@backup_host] pg_probackup-11 backup -B /mnt/backups --instance 'pg-11' -b delta --stream --remote-host=postgres_host --remote-user=postgres -U probackup -d backupdb
1926+ INFO: Backup start, pg_probackup version: 2.2.0, instance: node, backup ID: PZ7YMP, backup mode: DELTA, wal mode: STREAM, remote: true, compress-algorithm: none, compress-level: 1
1927+ INFO: Parent backup: PZ7YK2
1928+ INFO: Start transferring data files
1929+ INFO: Data files are transferred
1930+ INFO: wait for pg_stop_backup()
1931+ INFO: pg_stop backup() successfully executed
1932+ INFO: Validating backup PZ7YMP
1933+ INFO: Backup PZ7YMP data files are valid
1934+ INFO: Backup PZ7YMP resident size: 32MB
1935+ INFO: Backup PZ7YMP completed
19241936```
19251937
1926- 8 . Take incremental backup in DELTA mode:
1938+ 8 . Lets hide some parameters into config, so cmdline can looks less crodwy:
19271939```
1928- [backupman@backup_host] pg_probackup-11 backup -B /mnt/backups --instance 'pg-11' -b delta --stream
1940+ [backupman@backup_host] pg_probackup-11 set-config -B /mnt/backups --instance 'pg-11' --remote-host=postgres_host --remote-user=postgres -U probackup -d backupdb
19291941```
19301942
1943+ 9 . Take another incremental backup in DELTA mode, omitting the ` --remote-host ` , ` --remote-user ` , ` -U ` and ` -d ` options:
1944+ ```
1945+ [backupman@backup_host] pg_probackup-11 backup -B /mnt/backups --instance 'pg-11' -b delta --stream
1946+ INFO: Backup start, pg_probackup version: 2.2.0, instance: node, backup ID: PZ7YR5, backup mode: DELTA, wal mode: STREAM, remote: true, compress-algorithm: none, compress-level: 1
1947+ INFO: Parent backup: PZ7YMP
1948+ INFO: Start transferring data files
1949+ INFO: Data files are transferred
1950+ INFO: wait for pg_stop_backup()
1951+ INFO: pg_stop backup() successfully executed
1952+ INFO: Validating backup PZ7YR5
1953+ INFO: Backup PZ7YR5 data files are valid
1954+ INFO: Backup PZ7YR5 resident size: 32MB
1955+ INFO: Backup PZ7YR5 completed
1956+ ```
19311957
1958+ 10 . Lets take a look at instance config:
1959+ ```
1960+ [backupman@backup_host] pg_probackup-11 show-config -B /mnt/backups --instance 'pg-11'
1961+
1962+ # Backup instance information
1963+ pgdata = /var/lib/postgresql/11/main
1964+ system-identifier = 6746586934060931492
1965+ xlog-seg-size = 16777216
1966+ # Connection parameters
1967+ pgdatabase = backupdb
1968+ pghost = postgres_host
1969+ pguser = probackup
1970+ # Replica parameters
1971+ replica-timeout = 5min
1972+ # Archive parameters
1973+ archive-timeout = 5min
1974+ # Logging parameters
1975+ log-level-console = INFO
1976+ log-level-file = OFF
1977+ log-filename = pg_probackup.log
1978+ log-rotation-size = 0
1979+ log-rotation-age = 0
1980+ # Retention parameters
1981+ retention-redundancy = 0
1982+ retention-window = 0
1983+ wal-depth = 0
1984+ # Compression parameters
1985+ compress-algorithm = none
1986+ compress-level = 1
1987+ # Remote access parameters
1988+ remote-proto = ssh
1989+ remote-host = postgres_host
1990+ ```
19321991
1933- ####
1934-
1935- ### Setup with WAL archive
1992+ Note, that we are getting default values for other options, that were not overwritten by set-config command.
19361993
1937- The fact of having an WAL archive dramatically improve you scope of options toward backup and restore operations.
19381994
1995+ 10 . Lets take a look at the backup catalog:
1996+ ```
1997+ [backupman@backup_host] pg_probackup-11 backup -B /mnt/backups --instance 'pg-11'
1998+
1999+ ====================================================================================================================================
2000+ Instance Version ID Recovery Time Mode WAL Mode TLI Time Data WAL Zratio Start LSN Stop LSN Status
2001+ ====================================================================================================================================
2002+ node 11 PZ7YR5 2019-10-11 19:49:56+03 DELTA STREAM 1/1 10s 112kB 32MB 1.00 0/41000028 0/41000160 OK
2003+ node 11 PZ7YMP 2019-10-11 19:47:16+03 DELTA STREAM 1/1 10s 376kB 32MB 1.00 0/3E000028 0/3F0000B8 OK
2004+ node 11 PZ7YK2 2019-10-11 19:45:45+03 FULL STREAM 1/0 11s 180MB 16MB 1.00 0/3C000028 0/3C000198 OK
2005+ ```
19392006
19402007## Authors
19412008Postgres Professional, Moscow, Russia.
0 commit comments