5
5
pg_arman - Backup and recovery manager for PostgreSQL
6
6
7
7
##SYNOPSIS
8
-
8
+ ```
9
9
pg_arman [ OPTIONS ]
10
10
{ init |
11
11
backup |
12
12
restore |
13
13
show [ DATE | timeline ] |
14
14
validate [ DATE ] |
15
15
delete DATE }
16
+ ```
16
17
17
18
DATE is the start time of the target backup in ISO-format:
18
19
(YYYY-MM-DD HH:MI: SS ). Prefix match is used to compare DATE and backup
@@ -33,26 +34,26 @@ It proposes the following features:
33
34
34
35
##COMMANDS
35
36
36
- pg_arman supports the following commands. See also* OPTIONS* for more
37
+ pg_arman supports the following commands. See also** OPTIONS* * for more
37
38
details.
38
39
39
- * init* ::
40
+ ** init** :
40
41
Initialize a backup catalog.
41
42
42
- * backup* ::
43
+ ** backup** :
43
44
Take an online backup.
44
45
45
- * restore* ::
46
+ ** restore** :
46
47
Perform restore.
47
48
48
- * show* ::
49
+ ** show** :
49
50
Show backup history. The timeline option shows timeline of the backup
50
51
and the parent's timeline for each backup.
51
52
52
- * validate* ::
53
+ ** validate** :
53
54
Validate backup files.
54
55
55
- * delete* ::
56
+ ** delete** :
56
57
Delete backup files.
57
58
58
59
###INITIALIZATION
@@ -64,7 +65,9 @@ are initialized, pg_arman can adjust the config file to the setting. In this
64
65
case, you have to specify the database cluster path for PostgreSQL. Please
65
66
specify it in PGDATA environmental variable or -D/--pgdata option.
66
67
67
- $ pg_arman init -B /path/to/backup/
68
+ ```
69
+ $ pg_arman init -B /path/to/backup/
70
+ ```
68
71
69
72
###BACKUP
70
73
@@ -105,37 +108,42 @@ To reduce the number of command line arguments, you can set BACKUP_PATH,
105
108
an environment variable, to the absolute path of the backup catalog and
106
109
write default configuration into ${BACKUP_PATH}/pg_arman.ini.
107
110
108
- $ cat $BACKUP_PATH/pg_arman.ini
109
- ARCLOG_PATH = /home/postgres/arclog
110
- BACKUP_MODE = FULL
111
- KEEP_DATA_GENERATIONS = 3
112
- KEEP_DATA_DAYS = 120
111
+ ```
112
+ $ cat $BACKUP_PATH/pg_arman.ini
113
+ ARCLOG_PATH = /home/postgres/arclog
114
+ BACKUP_MODE = FULL
115
+ KEEP_DATA_GENERATIONS = 3
116
+ KEEP_DATA_DAYS = 120
117
+ ```
113
118
114
119
###TAKE A BACKUP
115
120
116
121
This example takes a full backup of the whole database. Then, it validates
117
122
all unvalidated backups.
118
-
119
- $ pg_arman backup --backup-mode=full
120
- $ pg_arman validate
123
+ ```
124
+ $ pg_arman backup --backup-mode=full
125
+ $ pg_arman validate
126
+ ```
121
127
122
128
###RESTORE FROM A BACKUP
123
129
124
130
Here are some commands to restore from a backup:
125
131
126
- $ pg_ctl stop -m immediate
127
- $ pg_arman restore
128
- $ pg_ctl start
132
+ ```
133
+ $ pg_ctl stop -m immediate
134
+ $ pg_arman restore
135
+ $ pg_ctl start
136
+ ```
129
137
130
138
###SHOW A BACKUP
131
139
```
132
- $ pg_arman show
133
- ===================================================================================
134
- Start Mode Current TLI Parent TLI Time Data Backup Status
135
- ===================================================================================
136
- 2013-12-25 03:02:31 PAGE 1 0 0m 203kB 67MB DONE
137
- 2013-12-25 03:02:31 PAGE 1 0 0m 0B 0B ERROR
138
- 2013-12-25 03:02:25 FULL 1 0 0m 33MB 364MB OK
140
+ $ pg_arman show
141
+ ===================================================================================
142
+ Start Mode Current TLI Parent TLI Time Data Backup Status
143
+ ===================================================================================
144
+ 2013-12-25 03:02:31 PAGE 1 0 0m 203kB 67MB DONE
145
+ 2013-12-25 03:02:31 PAGE 1 0 0m 0B 0B ERROR
146
+ 2013-12-25 03:02:25 FULL 1 0 0m 33MB 364MB OK
139
147
```
140
148
The fields are:
141
149
@@ -158,21 +166,23 @@ The fields are:
158
166
159
167
When a date is specified, more details about a backup is retrieved:
160
168
161
- $ pg_arman show '2011-11-27 19:15:45'
162
- # configuration
163
- BACKUP_MODE=FULL
164
- # result
165
- TIMELINEID=1
166
- START_LSN=0/08000020
167
- STOP_LSN=0/080000a0
168
- START_TIME='2011-11-27 19:15:45'
169
- END_TIME='2011-11-27 19:19:02'
170
- RECOVERY_XID=1759
171
- RECOVERY_TIME='2011-11-27 19:15:53'
172
- DATA_BYTES=25420184
173
- BLOCK_SIZE=8192
174
- XLOG_BLOCK_SIZE=8192
175
- STATUS=OK
169
+ ```
170
+ $ pg_arman show '2011-11-27 19:15:45'
171
+ # configuration
172
+ BACKUP_MODE=FULL
173
+ # result
174
+ TIMELINEID=1
175
+ START_LSN=0/08000020
176
+ STOP_LSN=0/080000a0
177
+ START_TIME='2011-11-27 19:15:45'
178
+ END_TIME='2011-11-27 19:19:02'
179
+ RECOVERY_XID=1759
180
+ RECOVERY_TIME='2011-11-27 19:15:53'
181
+ DATA_BYTES=25420184
182
+ BLOCK_SIZE=8192
183
+ XLOG_BLOCK_SIZE=8192
184
+ STATUS=OK
185
+ ```
176
186
177
187
You can check the "RECOVERY_XID" and "RECOVERY_TIME" which are used for
178
188
restore option "--recovery-target-xid", "--recovery-target-time".
@@ -192,11 +202,11 @@ details.
192
202
As a general rule, paths for data location need to be specified as
193
203
absolute paths; relative paths are not allowed.
194
204
195
- * -D* _ PATH _ /* --pgdata* = _ PATH _ ::
205
+ ** -D** * PATH * /** --pgdata** = * PATH * :
196
206
The absolute path of database cluster. Required on backup and
197
207
restore.
198
208
199
- * -A* _ PATH _ /* --arclog-path* = _ PATH _ ::
209
+ ** -A** * PATH * /** --arclog-path** = * PATH * :
200
210
The absolute path of archive WAL directory. Required for restore
201
211
and show command.
202
212