2016-05-31 13:08:51 +02:00
|
|
|
# pg_arman(1)
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 13:08:51 +02:00
|
|
|
## NAME
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2014-01-27 06:02:56 +03:00
|
|
|
pg_arman - Backup and recovery manager for PostgreSQL
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 13:08:51 +02:00
|
|
|
## SYNOPSIS
|
2016-05-31 13:16:14 +02:00
|
|
|
```
|
2014-01-27 06:02:56 +03:00
|
|
|
pg_arman [ OPTIONS ]
|
2013-12-24 21:48:36 +03:00
|
|
|
{ init |
|
|
|
|
backup |
|
|
|
|
restore |
|
|
|
|
show [ DATE | timeline ] |
|
|
|
|
validate [ DATE ] |
|
|
|
|
delete DATE }
|
2016-05-31 13:16:14 +02:00
|
|
|
```
|
2013-12-24 21:48:36 +03:00
|
|
|
|
|
|
|
DATE is the start time of the target backup in ISO-format:
|
|
|
|
(YYYY-MM-DD HH:MI:SS). Prefix match is used to compare DATE and backup
|
|
|
|
files.
|
|
|
|
|
2016-05-31 13:08:51 +02:00
|
|
|
## DESCRIPTION
|
2014-01-11 21:03:30 +03:00
|
|
|
|
2014-01-27 06:02:56 +03:00
|
|
|
pg_arman is a utility program to backup and restore PostgreSQL database.
|
2014-01-11 21:03:30 +03:00
|
|
|
|
|
|
|
It proposes the following features:
|
2014-01-11 21:25:54 +03:00
|
|
|
|
2014-01-11 21:03:30 +03:00
|
|
|
- Backup while database runs including tablespaces with just one
|
|
|
|
command
|
|
|
|
- Recovery from backup with just one command, with customized targets
|
|
|
|
to facilitate the use of PITR.
|
2016-05-31 15:09:57 +02:00
|
|
|
- Support for full and differential backup + ptrack differential backup
|
2014-01-11 21:03:30 +03:00
|
|
|
- Management of backups with integrated catalog
|
|
|
|
|
2016-05-31 13:08:51 +02:00
|
|
|
## COMMANDS
|
2014-01-11 21:03:30 +03:00
|
|
|
|
2016-05-31 13:16:14 +02:00
|
|
|
pg_arman supports the following commands. See also **OPTIONS** for more
|
2014-01-11 21:25:54 +03:00
|
|
|
details.
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 13:34:16 +02:00
|
|
|
* **init**:
|
|
|
|
Initialize a backup catalog.
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 13:34:16 +02:00
|
|
|
* **backup**:
|
|
|
|
Take an online backup.
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 13:34:16 +02:00
|
|
|
* **restore**:
|
|
|
|
Perform restore.
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 13:34:16 +02:00
|
|
|
* **show**:
|
|
|
|
Show backup history. The timeline option shows timeline of the backup and the parent's timeline for each backup.
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 13:34:16 +02:00
|
|
|
* **validate**:
|
2013-12-24 21:48:36 +03:00
|
|
|
Validate backup files.
|
|
|
|
|
2016-05-31 13:34:16 +02:00
|
|
|
* **delete**:
|
|
|
|
Delete backup files.
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 13:08:51 +02:00
|
|
|
### INITIALIZATION
|
2013-12-24 21:48:36 +03:00
|
|
|
|
|
|
|
First, you need to create "a backup catalog" to store backup files and
|
|
|
|
their metadata. It is recommended to setup archive_mode and archive_command
|
|
|
|
in postgresql.conf before initializing the backup catalog. If the variables
|
2014-01-27 06:02:56 +03:00
|
|
|
are initialized, pg_arman can adjust the config file to the setting. In this
|
2013-12-24 21:48:36 +03:00
|
|
|
case, you have to specify the database cluster path for PostgreSQL. Please
|
|
|
|
specify it in PGDATA environmental variable or -D/--pgdata option.
|
|
|
|
|
2016-05-31 13:16:14 +02:00
|
|
|
```
|
|
|
|
$ pg_arman init -B /path/to/backup/
|
|
|
|
```
|
2014-01-11 21:03:30 +03:00
|
|
|
|
2016-05-31 13:08:51 +02:00
|
|
|
### BACKUP
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2014-01-24 14:37:13 +03:00
|
|
|
Backup target can be one of the following types:
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2014-01-27 06:10:54 +03:00
|
|
|
- Full backup, backup a whole database cluster.
|
2014-01-30 09:58:55 +03:00
|
|
|
- Differential backup, backup only files or pages modified after the last
|
2016-01-15 16:47:38 +02:00
|
|
|
verified backup. A scan of the WAL records since the last backup up to the
|
|
|
|
LSN position of pg_start_backup is done and all the blocks touched are
|
|
|
|
recorded and tracked as part of the backup. As the WAL segments scanned
|
|
|
|
need to be located in the WAL archive, the last segment after pg_start_backup
|
|
|
|
has been run needs to be forcibly switched.
|
2016-05-31 15:09:57 +02:00
|
|
|
- ptrack differential backup, use bitmap ptrack file for detect changed pages.
|
|
|
|
For use it you need set ptrack_enable option to "on".
|
2013-12-24 21:48:36 +03:00
|
|
|
|
|
|
|
It is recommended to verify backup files as soon as possible after backup.
|
2016-05-31 15:09:57 +02:00
|
|
|
Unverified backup cannot be used in restore and in differential backups.
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 13:08:51 +02:00
|
|
|
### RESTORE
|
2014-01-11 21:03:30 +03:00
|
|
|
|
2013-12-24 21:48:36 +03:00
|
|
|
PostgreSQL server should be stopped before performing a restore. If database
|
|
|
|
cluster still exists, restore command will save unarchived transaction log
|
|
|
|
and delete all database files. You can retry recovery until a new backup is
|
2014-01-27 06:02:56 +03:00
|
|
|
taken. After restoring files, pg_arman creates recovery.conf in $PGDATA. The
|
2013-12-24 21:48:36 +03:00
|
|
|
conf file contains parameters for recovery. It is as well possible to modify
|
|
|
|
the file manually.
|
|
|
|
|
|
|
|
It is recommended to take a full backup as soon as possible after recovery
|
|
|
|
has succeeded.
|
|
|
|
|
|
|
|
If "--recovery-target-timeline" is not specifed, the last checkpoint's
|
|
|
|
TimeLineID in control file ($PGDATA/global/pg_control) will be the restore
|
|
|
|
target. If pg_control is not present, TimeLineID in the full backup used by
|
2014-01-27 06:10:54 +03:00
|
|
|
the restore will be a restore target.
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2014-01-11 21:03:30 +03:00
|
|
|
|
2016-05-31 13:08:51 +02:00
|
|
|
### EXAMPLES
|
2013-12-24 21:48:36 +03:00
|
|
|
|
|
|
|
To reduce the number of command line arguments, you can set BACKUP_PATH,
|
|
|
|
an environment variable, to the absolute path of the backup catalog and
|
2014-01-27 06:02:56 +03:00
|
|
|
write default configuration into ${BACKUP_PATH}/pg_arman.ini.
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 13:16:14 +02:00
|
|
|
```
|
|
|
|
$ cat $BACKUP_PATH/pg_arman.ini
|
|
|
|
ARCLOG_PATH = /home/postgres/arclog
|
|
|
|
BACKUP_MODE = FULL
|
|
|
|
KEEP_DATA_GENERATIONS = 3
|
|
|
|
KEEP_DATA_DAYS = 120
|
|
|
|
```
|
2014-01-11 21:03:30 +03:00
|
|
|
|
2016-05-31 13:08:51 +02:00
|
|
|
### TAKE A BACKUP
|
2014-01-11 21:03:30 +03:00
|
|
|
|
2014-01-24 14:37:13 +03:00
|
|
|
This example takes a full backup of the whole database. Then, it validates
|
|
|
|
all unvalidated backups.
|
2016-05-31 13:16:14 +02:00
|
|
|
```
|
|
|
|
$ pg_arman backup --backup-mode=full
|
|
|
|
$ pg_arman validate
|
|
|
|
```
|
2014-01-11 21:03:30 +03:00
|
|
|
|
2016-05-31 13:08:51 +02:00
|
|
|
### RESTORE FROM A BACKUP
|
2014-01-11 21:03:30 +03:00
|
|
|
|
|
|
|
Here are some commands to restore from a backup:
|
2014-01-11 21:25:54 +03:00
|
|
|
|
2016-05-31 13:16:14 +02:00
|
|
|
```
|
|
|
|
$ pg_ctl stop -m immediate
|
|
|
|
$ pg_arman restore
|
|
|
|
$ pg_ctl start
|
|
|
|
```
|
2014-01-11 21:03:30 +03:00
|
|
|
|
2016-05-31 13:08:51 +02:00
|
|
|
### SHOW A BACKUP
|
|
|
|
```
|
2016-05-31 13:16:14 +02:00
|
|
|
$ pg_arman show
|
|
|
|
===================================================================================
|
|
|
|
Start Mode Current TLI Parent TLI Time Data Backup Status
|
|
|
|
===================================================================================
|
|
|
|
2013-12-25 03:02:31 PAGE 1 0 0m 203kB 67MB DONE
|
|
|
|
2013-12-25 03:02:31 PAGE 1 0 0m 0B 0B ERROR
|
|
|
|
2013-12-25 03:02:25 FULL 1 0 0m 33MB 364MB OK
|
2016-05-31 13:08:51 +02:00
|
|
|
```
|
2013-12-24 21:48:36 +03:00
|
|
|
The fields are:
|
2014-01-11 21:25:54 +03:00
|
|
|
|
|
|
|
* Start: start time of backup
|
2016-05-31 15:09:57 +02:00
|
|
|
* Mode: Mode of backup: FULL (full) or PAGE (page differential) or PTRACK (differential by ptrack)
|
2014-01-11 21:25:54 +03:00
|
|
|
* Current TLI: current timeline of backup
|
|
|
|
* Parent TLI: parent timeline of backup
|
|
|
|
* Time: total time necessary to take this backup
|
|
|
|
* Data: size of data files
|
|
|
|
* Log: size of read server log files
|
|
|
|
* Backup: size of backup (= written size)
|
|
|
|
* Status: status of backup. Possible values are:
|
2016-05-31 13:34:16 +02:00
|
|
|
* OK : backup is done and validated.
|
|
|
|
* DONE : backup is done, but not validated yet.
|
|
|
|
* RUNNING : backup is running
|
|
|
|
* DELETING : backup is being deleted.
|
|
|
|
* DELETED : backup has been deleted.
|
|
|
|
* ERROR : backup is unavailable because some errors occur during backup.
|
|
|
|
* CORRUPT : backup is unavailable because it is broken.
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2014-01-11 21:03:30 +03:00
|
|
|
When a date is specified, more details about a backup is retrieved:
|
|
|
|
|
2016-05-31 13:16:14 +02:00
|
|
|
```
|
|
|
|
$ pg_arman show '2011-11-27 19:15:45'
|
|
|
|
# configuration
|
|
|
|
BACKUP_MODE=FULL
|
|
|
|
# result
|
|
|
|
TIMELINEID=1
|
|
|
|
START_LSN=0/08000020
|
|
|
|
STOP_LSN=0/080000a0
|
|
|
|
START_TIME='2011-11-27 19:15:45'
|
|
|
|
END_TIME='2011-11-27 19:19:02'
|
|
|
|
RECOVERY_XID=1759
|
|
|
|
RECOVERY_TIME='2011-11-27 19:15:53'
|
|
|
|
DATA_BYTES=25420184
|
|
|
|
BLOCK_SIZE=8192
|
|
|
|
XLOG_BLOCK_SIZE=8192
|
|
|
|
STATUS=OK
|
|
|
|
```
|
2013-12-24 21:48:36 +03:00
|
|
|
|
|
|
|
You can check the "RECOVERY_XID" and "RECOVERY_TIME" which are used for
|
|
|
|
restore option "--recovery-target-xid", "--recovery-target-time".
|
|
|
|
|
|
|
|
The delete command deletes backup files not required by recovery after
|
2016-01-18 09:11:47 +02:00
|
|
|
the specified date. This command also cleans up in the WAL archive the
|
|
|
|
WAL segments that are no longer needed to restore from the remaining
|
|
|
|
backups.
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 13:08:51 +02:00
|
|
|
### OPTIONS
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2014-01-27 06:02:56 +03:00
|
|
|
pg_arman accepts the following command line parameters. Some of them can
|
2014-01-11 21:50:13 +03:00
|
|
|
be also specified as environment variables. See also *PARAMETERS* for the
|
2013-12-24 21:48:36 +03:00
|
|
|
details.
|
|
|
|
|
2016-05-31 13:08:51 +02:00
|
|
|
### COMMON OPTIONS
|
2013-12-24 21:48:36 +03:00
|
|
|
As a general rule, paths for data location need to be specified as
|
|
|
|
absolute paths; relative paths are not allowed.
|
|
|
|
|
2016-05-31 13:34:16 +02:00
|
|
|
**-D** PATH / **--pgdata**=PATH:
|
2013-12-24 21:48:36 +03:00
|
|
|
The absolute path of database cluster. Required on backup and
|
|
|
|
restore.
|
|
|
|
|
2016-05-31 13:34:16 +02:00
|
|
|
**-A** PATH / **--arclog-path**=PATH:
|
2014-01-24 16:36:31 +03:00
|
|
|
The absolute path of archive WAL directory. Required for restore
|
|
|
|
and show command.
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 13:34:16 +02:00
|
|
|
**-B** PATH / **--backup-path**=PATH:
|
2013-12-24 21:48:36 +03:00
|
|
|
The absolute path of backup catalog. This option is mandatory.
|
|
|
|
|
2016-05-31 13:21:16 +02:00
|
|
|
**-c** / **--check**:
|
2014-01-27 06:02:56 +03:00
|
|
|
If specifed, pg_arman doesn't perform actual jobs but only checks
|
2013-12-24 21:48:36 +03:00
|
|
|
parameters and required resources. The option is typically used with
|
2014-01-27 06:10:54 +03:00
|
|
|
--verbose option to verify the operation.
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 13:21:16 +02:00
|
|
|
### BACKUP OPTIONS
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 13:21:16 +02:00
|
|
|
**-b** BACKUPMODE / **--backup-mode**=BACKUPMODE:
|
2014-01-11 21:50:13 +03:00
|
|
|
Specify backup target files. Available options are: "full",
|
2016-05-31 19:22:54 +02:00
|
|
|
"page", "ptrack".
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 13:21:16 +02:00
|
|
|
**-C** / **--smooth-checkpoint**:
|
2013-12-24 21:48:36 +03:00
|
|
|
Checkpoint is performed on every backups. If the option is specified,
|
|
|
|
do smooth checkpoint then. See also the second argument for
|
2014-01-27 06:10:54 +03:00
|
|
|
pg_start_backup().
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 13:21:16 +02:00
|
|
|
**--validate**:
|
2014-01-17 16:42:27 +03:00
|
|
|
Validate a backup just after taking it. Other backups taken
|
|
|
|
previously are ignored.
|
|
|
|
|
2016-05-31 13:21:16 +02:00
|
|
|
**--keep-data-generations**=NUMBER / **--keep-data-days**=DAYS:
|
2013-12-24 21:48:36 +03:00
|
|
|
Specify how long backuped data files will be kept.
|
|
|
|
--keep-data-generations means number of backup generations.
|
|
|
|
--keep-data-days means days to be kept.
|
2014-01-09 20:37:33 +03:00
|
|
|
Only files exceeded one of those settings are deleted.
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-09-29 16:39:56 +02:00
|
|
|
**-j**=NUMBER / **--threads**=NUMBER:
|
|
|
|
Number of threads for backup.
|
2016-05-31 15:09:57 +02:00
|
|
|
|
2016-09-29 16:39:56 +02:00
|
|
|
**--stream**:
|
|
|
|
Enable stream replication for save WAL during backup process.
|
2016-09-01 17:35:43 +02:00
|
|
|
|
2016-09-29 16:39:56 +02:00
|
|
|
**--disable-ptrack-clear**:
|
|
|
|
Disable clear ptrack files for postgres without ptrack patch.
|
2016-05-31 15:09:57 +02:00
|
|
|
|
2016-09-29 16:39:56 +02:00
|
|
|
**--from-replica**:
|
|
|
|
Use non exclusive start backup for replica. Only for 9.6 and higher.
|
2016-09-29 16:33:21 +02:00
|
|
|
|
|
|
|
|
2016-05-31 13:08:51 +02:00
|
|
|
### RESTORE OPTIONS
|
2014-01-11 21:03:30 +03:00
|
|
|
|
2013-12-24 21:48:36 +03:00
|
|
|
The parameters whose name start are started with --recovery refer to
|
|
|
|
the same parameters as the ones in recovery.confin recovery.conf.
|
|
|
|
|
2016-05-31 13:40:04 +02:00
|
|
|
**--recovery-target-timeline**=_TIMELINE_:
|
2014-01-27 06:10:54 +03:00
|
|
|
Specifies recovering into a particular timeline. If not specified,
|
|
|
|
the current timeline is used.
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 13:40:04 +02:00
|
|
|
**--recovery-target-time**=TIMESTAMP:
|
2013-12-24 21:48:36 +03:00
|
|
|
This parameter specifies the timestamp up to which recovery will
|
|
|
|
proceed.
|
|
|
|
|
2016-05-31 13:40:04 +02:00
|
|
|
**--recovery-target-xid**=XID:
|
2013-12-24 21:48:36 +03:00
|
|
|
This parameter specifies the transaction ID up to which recovery
|
2014-01-27 06:10:54 +03:00
|
|
|
will proceed.
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 13:40:04 +02:00
|
|
|
**--recovery-target-inclusive**:
|
2013-12-24 21:48:36 +03:00
|
|
|
Specifies whether server pauses when recovery target is reached.
|
|
|
|
|
2016-09-29 16:39:56 +02:00
|
|
|
**-j**=NUMBER / **--threads**=NUMBER:
|
2016-05-31 15:09:57 +02:00
|
|
|
Number of threads for restore.
|
|
|
|
|
2016-09-29 16:39:56 +02:00
|
|
|
**--stream**:
|
2016-05-31 15:09:57 +02:00
|
|
|
Restore without recovery.conf and use pg_xlog WALs. Before you need
|
|
|
|
backup with **--stream** option. This option will disable all **--recovery-**
|
2016-09-01 17:31:19 +02:00
|
|
|
options.
|
|
|
|
|
2016-05-31 13:40:04 +02:00
|
|
|
### CATALOG OPTIONS
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 13:40:04 +02:00
|
|
|
**-a** / **--show-all**:
|
2013-12-24 21:48:36 +03:00
|
|
|
Show all existing backups, including the deleted ones.
|
|
|
|
|
2016-05-31 13:08:51 +02:00
|
|
|
### CONNECTION OPTIONS
|
2013-12-24 21:48:36 +03:00
|
|
|
Parameters to connect PostgreSQL server.
|
|
|
|
|
2016-05-31 13:40:04 +02:00
|
|
|
**-d** DBNAME / **--dbname**=DBNAME:
|
2013-12-24 21:48:36 +03:00
|
|
|
The database name to execute pg_start_backup() and pg_stop_backup().
|
|
|
|
|
2016-05-31 13:40:04 +02:00
|
|
|
**-h** HOSTNAME / **--host**=HOSTNAME:
|
2013-12-24 21:48:36 +03:00
|
|
|
Specifies the host name of the machine on which the server is running.
|
|
|
|
If the value begins with a slash, it is used as the directory for the
|
|
|
|
Unix domain socket.
|
|
|
|
|
2016-05-31 13:40:04 +02:00
|
|
|
**-p** PORT / **--port**=PORT:
|
2013-12-24 21:48:36 +03:00
|
|
|
Specifies the TCP port or local Unix domain socket file extension on
|
|
|
|
which the server is listening for connections.
|
|
|
|
|
2016-05-31 13:40:04 +02:00
|
|
|
**-U** USERNAME / **--username**=USERNAME:
|
2014-01-27 06:10:54 +03:00
|
|
|
User name to connect as.
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 13:40:04 +02:00
|
|
|
**-w** / **--no-password**:
|
2013-12-24 21:48:36 +03:00
|
|
|
Never issue a password prompt. If the server requires password
|
|
|
|
authentication and a password is not available by other means such as
|
|
|
|
a .pgpass file, the connection attempt will fail. This option can be
|
|
|
|
useful in batch jobs and scripts where no user is present to enter a
|
2014-01-27 06:10:54 +03:00
|
|
|
password.
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 13:40:04 +02:00
|
|
|
**-W** / **--password**:
|
2014-01-27 06:02:56 +03:00
|
|
|
Force pg_arman to prompt for a password before connecting to a database.
|
|
|
|
This option is never essential, since pg_arman will automatically
|
2013-12-24 21:48:36 +03:00
|
|
|
prompt for a password if the server demands password authentication.
|
2014-01-27 06:02:56 +03:00
|
|
|
However, pg_arman will waste a connection attempt in order to find out
|
2013-12-24 21:48:36 +03:00
|
|
|
if the server wants a password. In some cases it is worth typing -W
|
2014-01-27 06:10:54 +03:00
|
|
|
to avoid the extra connection attempt.
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 13:08:51 +02:00
|
|
|
### GLOBAL OPTIONS
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 13:40:04 +02:00
|
|
|
**--help**:
|
2013-12-24 21:48:36 +03:00
|
|
|
Print help, then exit.
|
|
|
|
|
2016-05-31 13:40:04 +02:00
|
|
|
**-V** / **--version**:
|
2013-12-24 21:48:36 +03:00
|
|
|
Print version information, then exit.
|
|
|
|
|
2016-05-31 13:40:04 +02:00
|
|
|
**-v** / **--verbose**:
|
2016-01-14 09:36:39 +02:00
|
|
|
If specified, pg_arman works in verbose mode.
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 13:08:51 +02:00
|
|
|
## PARAMETERS
|
2013-12-24 21:48:36 +03:00
|
|
|
|
|
|
|
Some of parameters can be specified as command line arguments, environment
|
|
|
|
variables or in configuration file as follows:
|
2016-05-31 13:21:16 +02:00
|
|
|
```
|
2016-05-31 13:44:42 +02:00
|
|
|
Short Long Env File
|
|
|
|
-h --host PGHOST No
|
|
|
|
-p --port PGPORT No
|
|
|
|
-d --dbname PGDATABASE No
|
|
|
|
-U --username PGUSER No
|
|
|
|
PGPASSWORD No
|
|
|
|
-w --password No
|
|
|
|
-W --no-password No
|
|
|
|
-D --pgdata PGDATA Yes
|
|
|
|
-B --backup-path BACKUP_PATH Yes
|
|
|
|
-A --arclog-path ARCLOG_PATH Yes
|
|
|
|
-b --backup-mode BACKUP_MODE Yes
|
|
|
|
-C --smooth-checkpoint SMOOTH_CHECKPOINT Yes
|
|
|
|
--validate VALIDATE Yes
|
|
|
|
--keep-data-generations KEEP_DATA_GENERATIONS Yes
|
|
|
|
--keep-data-days KEEP_DATA_DAYS Yes
|
|
|
|
--recovery-target-timeline RECOVERY_TARGET_TIMELINE Yes
|
|
|
|
--recovery-target-xid RECOVERY_TARGET_XID Yes
|
|
|
|
--recovery-target-time RECOVERY_TARGET_TIME Yes
|
|
|
|
--recovery-target-inclusive RECOVERY_TARGET_INCLUSIVE Yes
|
2016-05-31 13:21:16 +02:00
|
|
|
```
|
2013-12-24 21:48:36 +03:00
|
|
|
|
|
|
|
Variable names in configuration file are the same as long names or names
|
|
|
|
of environment variables. The password can not be specified in command
|
2014-01-27 06:10:54 +03:00
|
|
|
line and configuration file for security reason.
|
2013-12-24 21:48:36 +03:00
|
|
|
|
|
|
|
This utility, like most other PostgreSQL utilities, also uses the
|
2014-01-27 06:10:54 +03:00
|
|
|
environment variables supported by libpq (see Environment Variables).
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 15:09:57 +02:00
|
|
|
## RESTRICTIONS
|
2014-01-11 21:03:30 +03:00
|
|
|
|
2014-01-27 06:02:56 +03:00
|
|
|
pg_arman has the following restrictions.
|
2013-12-24 21:48:36 +03:00
|
|
|
|
|
|
|
- Requires to read database cluster directory and write backup catalog
|
|
|
|
directory. It is usually necessary to mount the disk where backup
|
|
|
|
catalog is placed with NFS or related from database server.
|
2014-01-27 06:02:56 +03:00
|
|
|
- Major versions of pg_arman and server should match.
|
|
|
|
- Block sizes of pg_arman and server should match.
|
2013-12-24 21:48:36 +03:00
|
|
|
- If there are some unreadable files/directories in data folder of server
|
|
|
|
WAL directory or archived WAL directory, the backup or restore will fail
|
|
|
|
depending on the backup mode selected.
|
|
|
|
|
2016-05-31 15:09:57 +02:00
|
|
|
## DETAILS
|
2014-01-11 21:03:30 +03:00
|
|
|
|
2016-05-31 13:08:51 +02:00
|
|
|
### RECOVERY TO POINT-IN-TIME
|
2014-01-27 06:02:56 +03:00
|
|
|
pg_arman can recover to point-in-time if timeline, transaction ID, or
|
2013-12-24 21:48:36 +03:00
|
|
|
timestamp is specified in recovery.conf. xlogdump is a contrib module of
|
|
|
|
PostgreSQL core that allows checking in the content of WAL files and
|
|
|
|
determine when to recover. This might help.
|
|
|
|
|
2016-05-31 13:08:51 +02:00
|
|
|
### CONFIGURATION FILE
|
2013-12-24 21:48:36 +03:00
|
|
|
Setting parameters in configuration file is done as "name=value". Quotes
|
|
|
|
are required if the value contains whitespaces. Comments should start with
|
|
|
|
"#" and are automatically ignored. Whitespaces and tabs are ignored
|
|
|
|
excluding values.
|
|
|
|
|
2016-05-31 15:09:57 +02:00
|
|
|
### RESTRICTIONS
|
|
|
|
* In order to work, the PostgreSQL instance on which backups are taken need
|
|
|
|
to have data checksums enabled or to enable wal_log_hints.
|
|
|
|
* pg_arman is aimed at working with PostgreSQL 9.5 and newer versions.
|
|
|
|
* For ptrack feature you need special version of Postgres and set wal_level to
|
|
|
|
archive or hot_standby and ptrack_enable.
|
|
|
|
* For stream feature you need configure streaming replication in your postgres.
|
2016-01-14 09:36:39 +02:00
|
|
|
|
2016-05-31 13:08:51 +02:00
|
|
|
### EXIT CODE
|
2014-01-27 06:02:56 +03:00
|
|
|
pg_arman returns exit codes for each error status.
|
2013-12-24 21:48:36 +03:00
|
|
|
|
2016-05-31 13:21:16 +02:00
|
|
|
```
|
2016-05-31 13:40:04 +02:00
|
|
|
Code Name Description
|
|
|
|
0 SUCCESS Operation succeeded.
|
|
|
|
1 ERROR Generic error
|
|
|
|
2 FATAL Exit because of repeated errors
|
|
|
|
3 PANIC Unknown critical condition
|
2016-05-31 13:21:16 +02:00
|
|
|
```
|
2014-01-11 21:03:30 +03:00
|
|
|
|
2016-05-31 13:08:51 +02:00
|
|
|
## AUTHOR ##
|
2016-01-14 09:36:39 +02:00
|
|
|
pg_arman is a fork of pg_arman that was originally written by NTT, now
|
|
|
|
developed and maintained by Michael Paquier.
|
2016-05-31 15:09:57 +02:00
|
|
|
Threads, WAL diff, ptrack diff, stream WAL and some other features developed by
|
|
|
|
Yury Zhuravlev aka stalkerg from PostgresPro.
|
2014-01-11 21:03:30 +03:00
|
|
|
|
2016-05-31 15:34:45 +02:00
|
|
|
Please report bug reports at <https://github.com/postgrespro/pg_arman/issues>.
|