1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333
|
'\" t
.\" Title: ampgsql
.\" Author: Nikolas Coukouma <atrus@zmanda.com>
.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
.\" Date: 02/21/2012
.\" Manual: System Administration Commands
.\" Source: Amanda 3.3.1
.\" Language: English
.\"
.TH "AMPGSQL" "8" "02/21/2012" "Amanda 3\&.3\&.1" "System Administration Commands"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
ampgsql \- Amanda Application to interface with PostgreSQL
.SH "DESCRIPTION"
.PP
Ampgsql is an Amanda Application API script\&. It should not be run by users directly\&. It implements on\-line backups of PostgreSQL databases in conjunction with WAL archiving\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.PP
Tablespaces are not currently supported\&.
.sp .5v
.RE
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.PP
On versions of PostgreSQL earlier than 8\&.2, if the database is quiet during a full backup, then the backup may not complete until enough database activity takes place to trigger the archiving of the current WAL file\&. Consider adjusting the PG\-MAX\-WAL\-WAIT property from its default (60s) to compensate\&. Note that you will need to increase
\fBdtimeout\fR
on the server accordingly\&.
.sp .5v
.RE
.SH "OPERATION"
.PP
This application implements the backup strategy described in
http://www\&.postgresql\&.org/docs/current/static/continuous\-archiving\&.html\&. For a level zero (full) backup, ampgsql:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
execute PG_START_BACKUP()
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
dump the data directory
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
execute PG_STOP_BACKUP()
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
wait for the final WAL file to be archived
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
back up the required WAL files
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
optionally delete WAL files that are no longer necessary
.RE
.sp
The two dumps are made with GNU Tar, to
data_dir\&.tar
and
archive_dir, respectively\&. They are then combined into a single tar file\&.
.PP
A level N backup creates a single tar file containing all WAL files since the previous level N\-1 backup\&.
.SH "PROPERTIES"
.PP
This section lists the
\fBamanda.conf\fR(5)
properties that control ampsql\*(Aqs functionality\&. See
\fBamanda-applications\fR(7)
for information on application properties and how they are configured\&.
.PP
ARCHIVEDIR
.RS 4
Directory that WAL segment files are archived to, as specified by the archive_command in PosgreSQL\*(Aqs postgresql\&.conf\&. The amanda user on the client must have at least read and execute permission on this directory, and preferably write\&. Without write permission, Amanda cannot clean up expired WAL and backup files\&.
.RE
.PP
CLEANUPWAL
.RS 4
Whether or not to remove old WAL segment files during base backups\&. Defaults to yes\&.
.RE
.PP
DB
.RS 4
Database to connect to\&. Defaults to "template1" (which exists by default)\&.
.RE
.PP
DIRECTORY
.RS 4
For restore command only, the data is recoved in that directory\&. Must be a unix path\&.
.RE
.PP
GNUTAR\-PATH
.RS 4
Path to the GNU tar executable\&. This option only has an effect during restore\&. The default is set when Amanda is built by the \-\-with\-gnutar configure option\&.
.RE
.PP
HOST
.RS 4
Host to connect to\&. If it starts with "/" it will be interepreted as a directory that holds the socket file\&. PostgreSQL defaults to /tmp\&.
.RE
.PP
MAX\-WAL\-WAIT
.RS 4
The maximum amount of time to wait for PG_STOP_BACKUP to archive a WAL file\&. In versions of PostgreSQL before 8\&.2, PG_STOP_BACKUP does not automatically archive the latest WAL file, so a quiet database may wait a very long time before archiving the WAL file\&. Default: 60 seconds\&. Set to 0 to wait forever\&.
.RE
.PP
PASSFILE
.RS 4
Connect using the creditials in this file\&. Each line should have the format "hostname:port:database:username:password"\&. The permissions must permit it to be read only by the user, or the file will not be used\&. Only usable with Postgres 8\&.1 and up\&.
.RE
.PP
PORT
.RS 4
The TCP port to connect to, or the suffix of the socket file\&. PostgreSQL defaults to 5432\&.
.RE
.PP
PSQL\-PATH
.RS 4
Path to the psql binary\&. If not specified, the PATH environment variable will be searched\&.
.RE
.PP
STATEDIR
.RS 4
Directory for saving state about backups already made\&. The default is set when Amanda is built by the \-\-with\-gnutar\-listdir configure option\&.
.RE
.PP
TMPDIR
.RS 4
Directory to use for temporary files during the backup process\&. It should have enough space to store a complete copy of the database\&. The default is set when Amanda is built by the \-\-with\-tmpdir configure option\&.
.RE
.PP
USER
.RS 4
User to connect as\&. It must be a superuser\&.
.RE
.SH "CLIENT PROPERTIES"
.PP
Client properties are deprecated\&. All properties should be set in the dumptype\&.
.PP
This section lists the
\fBamanda-client.conf\fR(5)
properties that control ampsql\*(Aqs functionality\&. If a property is prefixed with the diskname and an underscore, then it will be used when that diskname is being backed up\&. For example, if the properties PG\-DATADIR and foo\-PG\-DATADIR are set, the value of PG\-DATADIR will be used when bar and baz are being backed up, but foo\-PG\-DATADIR will be used when foo is being backed up\&. Disknames are specified in the
\fBdisklist\fR(5)\&.
.PP
PG\-ARCHIVEDIR
.RS 4
Directory that WAL segment files are archived to, as specified by the archive_command
in PosgreSQL\*(Aqs postgresql\&.conf\&. The amanda user on the client must have at least read
and execute permission on this directory, and preferably write\&. Without write permission,
Amanda cannot clean up expired WAL and backup files\&.
.RE
.PP
PG\-CLEANUPWAL
.RS 4
Whether or not to remove old WAL segment files during base backups\&.
Defaults to yes\&.
.RE
.PP
PG\-DATADIR
.RS 4
Cluster data directory
.RE
.PP
PG\-DB
.RS 4
Database to connect to\&. Defaults to "template1" (which exists by default)\&.
.RE
.PP
PG\-HOST
.RS 4
Host to connect to\&. If it starts with "/" it will be interepreted as a directory
that holds the socket file\&. PostgreSQL defaults to /tmp\&.
.RE
.PP
PG\-MAX\-WAL\-WAIT
.RS 4
The maximum amount of time to wait for PG_STOP_BACKUP to archive a WAL file\&. In versions of PostgreSQL before 8\&.2, PG_STOP_BACKUP does not automatically archive the latest WAL file, so a quiet database may wait a very long time before archiving the WAL file\&. Default: 60 seconds\&. Set to 0 to wait forever\&.
.RE
.PP
PG\-PASSFILE
.RS 4
Connect using the creditials in this file\&. Each line should have the format
"hostname:port:database:username:password"\&. The permissions must
permit it to be read only by the user, or the file will not be used\&.
Only usable with Postgres 8\&.1 and up\&.
.RE
.PP
PG\-PASSWORD
.RS 4
Password to use when connecting\&. Deprecated in favor of passfiles\&.
.RE
.PP
PG\-PORT
.RS 4
The TCP port to connect to, or the suffix of the socket file\&. PostgreSQL
defaults to 5432\&.
.RE
.PP
PG\-USER
.RS 4
User to connect as\&. It must be a superuser\&.
.RE
.PP
PSQL\-PATH
.RS 4
Path to the psql binary\&. If not specified, the PATH environment variable
will be searched\&.
.RE
.SH "RECOVERY"
.PP
Read the postgres documentation carefully before attempting a recovery\&. This section is only a rough guide to the process\&.
.PP
The data recovered from a postgres backup consists of a data tarball and one or more archive tarballs\&. The data contains the state of the database at the time the full backup was performed, and the archive tarballs contain postgres WAL files that must be re\-run to generate a consistent state\&.
.PP
Ensure that the database server is shut down, and move the existing data directory aside\&. Untar the data tarball over this directory, and verify that ownership and permissions are correct\&. Untar all of the archive tarballs into a single directory \- the archive directory\&. Create a
recovery\&.conf
in the data directory, owned by the proper user and with proper permissions\&. Add a
\fBrestore_command\fR
to it, e\&.g\&.,
.nf
restore_command = \*(Aqcp /path/to/archive_dir/%f "%p"\*(Aq
.fi
.PP
Start the database server, and examine the logs to track the process of the recovery\&. When the recovery is complete, the server will transition into a running state, and will move the
recovery\&.conf
file aside so that it will not attempt a recovery on the next invocation\&.
.SH "SEE ALSO"
.PP
\fBamanda\fR(8),
\fBamanda.conf\fR(5),
\fBamanda-client.conf\fR(5),
\fBamanda-applications\fR(7)
.PP
The Amanda Wiki:
: http://wiki.zmanda.com/
.SH "AUTHOR"
.PP
\fBNikolas Coukouma\fR <\&atrus@zmanda\&.com\&>
.RS 4
Zmanda, Inc\&. (http://www\&.zmanda\&.com)
.RE
|