@@ -1834,15 +1834,15 @@ Deprecated. Wait time for WAL segment streaming via replication, in seconds. By
1834
1834
1835
1835
## Howto
1836
1836
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.
1838
1838
1839
1839
Examples are based on Ubuntu 18.04, PostgreSQL 11 and pg_probackup 2.2.0.
1840
1840
1841
1841
backup_host - host with backup catalog.
1842
1842
backupman - user on ` backup_host ` running all pg_probackup operations.
1843
1843
/mnt/backups - directory on ` backup_host ` where backup catalog is stored.
1844
1844
1845
- postgres_host - host with PostgreSQL cluster.
1845
+ postgres-host - host with PostgreSQL cluster.
1846
1846
postgres - user on ` postgres_host ` which run PostgreSQL cluster.
1847
1847
/var/lib/postgresql/11/main - directory on ` postgres_host ` where PGDATA of PostgreSQL cluster is located.
1848
1848
backup_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
1882
1882
COMMIT;
1883
1883
```
1884
1884
1885
- 3 . Init backup catalog:
1885
+ 3 . Init the backup catalog:
1886
1886
```
1887
1887
[backupman@backup_host]$ pg_probackup-11 init -B /mnt/backups
1888
1888
INFO: Backup catalog '/mnt/backups' successfully inited
@@ -1897,45 +1897,112 @@ INFO: Instance 'node' successfully inited
1897
1897
5 . Take FULL backup:
1898
1898
```
1899
1899
[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
1901
1901
INFO: Start transferring data files
1902
1902
INFO: Data files are transferred
1903
1903
INFO: wait for pg_stop_backup()
1904
1904
INFO: 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
1909
1909
```
1910
1910
1911
1911
6 . Lets take a look at the backup catalog:
1912
1912
```
1913
+ [backupman@backup_host] pg_probackup-11 backup -B /mnt/backups --instance 'pg-11'
1914
+
1913
1915
BACKUP INSTANCE 'pg-11'
1914
1916
==================================================================================================================================
1915
1917
Instance Version ID Recovery Time Mode WAL Mode TLI Time Data WAL Zratio Start LSN Stop LSN Status
1916
1918
==================================================================================================================================
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
1918
1920
1919
1921
```
1920
1922
1921
- 7 . Lets hide some options into config, so cmdline can be less crowdy :
1923
+ 7 . Take incremental backup in DELTA mode :
1922
1924
```
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
1924
1936
```
1925
1937
1926
- 8 . Take incremental backup in DELTA mode:
1938
+ 8 . Lets hide some parameters into config, so cmdline can looks less crodwy:
1927
1939
```
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
1929
1941
```
1930
1942
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
+ ```
1931
1957
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
+ ```
1932
1991
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.
1936
1993
1937
- The fact of having an WAL archive dramatically improve you scope of options toward backup and restore operations.
1938
1994
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
+ ```
1939
2006
1940
2007
## Authors
1941
2008
Postgres Professional, Moscow, Russia.
0 commit comments