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 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607
|
.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "MYLVMBACKUP 1"
.TH MYLVMBACKUP 1 "2009-06-26" "perl v5.10.0" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
mylvmbackup \- a utility for creating MySQL backups using LVM snapshots
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
mylvmbackup [\s-1OPTIONS\s0]
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
mylvmbackup is a tool for quickly creating backups of MySQL server's data
files. To perform a backup, mylvmbackup obtains a read lock on all tables and
flushes all server caches to disk, makes an \s-1LVM\s0 snapshot of the volume
containing the MySQL data directory, and unlocks the tables again. The
snapshot process takes only a small amount of time. When it is done, the
server can continue normal operations, while the actual file backup proceeds.
.PP
The \s-1LVM\s0 snapshot is mounted to a temporary directory and all data is backed up
using the \fItar\fR program. By default, the archive file is created using a name
of the form \fIbackup\-YYYYMMDD_hhmmss_mysql.tar.gz\fR, where \fI\s-1YYYY\s0\fR, \fI\s-1MM\s0\fR, \fI\s-1DD\s0\fR,
\&\fIhh\fR, \fImm\fR, and \fIss\fR represent the year, month, day, hour, minute, and second
of the time at which the backup occurred. The default prefix \fIbackup\fR, date
format and file suffix may be modified. The use of timestamped archive names
allows you to run mylvmbackup many times without danger of overwriting old
archives.
.PP
Alternatively, instead of \fItar\fR, you may use \fIrsync\fR. This process is nearly
identical, with the exception that the file suffix is not used. The rsync
backup can perform both local backups as well as backing up to a remote
server using rsyncd or rsync via \s-1SSH\s0.
.PP
mylvmbackup also supports creating backups by using \fIrsnap\fR, which is a
wrapper around \fIrsync\fR to automatically maintain and rotate a given number of
last backups (7 by default). It utilizes hard links to link to unchanged files
for saving disk space.
.PP
Additionally, a backup type \fInone\fR is provided for cases where the user wants
to use mylvmbackup only for creating the snapshots and intends to perform the
actual backup by using the appropriate hooks. (Or for cases where the snapshot
itself is considered to be the backup).
.SH "GENERAL HINTS"
.IX Header "GENERAL HINTS"
It is required to run mylvmbackup on the same host where the MySQL server
runs. If your MySQL daemon is not listening on localhost or using the default
socket location, you must specify \fI\-\-host\fR or \fI\-\-socket\fR. Even though
mylvmbackup communicates with the server through a normal client connection to
obtain the read lock and flush data, it performs the actual backup by
accessing the file system directly. It is also a requirement that the MySQL
server's data directory resides on an \s-1LVM\s0 volume. (It is, however, a good idea
to do the \s-1LVM\s0 backup to a different partition than the one where the data
directory resides. Otherwise, there is a good chance that \s-1LVM\s0 will run out of
undo space for \s-1LVM\s0 snapshot maintenance and the backup will fail.)
.PP
The user who invokes mylvmbackup must have sufficient filesystem permissions
to create the \s-1LVM\s0 snapshot and mount it. This includes read/write access to
the backup directory.
.PP
If you plan to back up InnoDB tables using \s-1LVM\s0 snapshots, be advised that it
is not sufficient to lock the tables and issue the \fI\s-1FLUSH\s0 \s-1TABLES\s0\fR command to
get the table files into a consistent state. When starting the MySQL server
from these restored files, InnoDB will detect these tables as being in an
inconsistent state and will perform a log recovery run before the tables can be
accessed again. As this can potentially take some time (which you may not want
to spend after restoring a server and trying to get it back on its feet as
fast as possible), consider using the option \fI\-\-innodb_recover\fR, which will
perform the recovery operation on the backup snapshot prior to archiving it.
.PP
The recovery operation is performed by spawning a second mysqld instance that
uses the snapshot volume as the data directory. Note that this functionality
currently assumes the default InnoDB configuration \- it does not work properly
if you use options like \fI\-\-innodb\-file\-per\-table\fR, \fI\-\-innodb\-data\-home\-dir\fR,
\&\fI\-\-innodb\-data\-file\-path\fR or \fI\-\-innodb\-log\-group\-home\-dir\fR that modify the
default file layout for InnoDB tables.
.PP
If you use InnoDB tables exclusively, you may also want to consider to include
the option \fI\-\-skip_flush_tables\fR, to avoid the probably time-consuming and in
this case unnecessary flushing of buffers. But don't enable this option when
MyISAM tables are involved!
.SH "HOOKS"
.IX Header "HOOKS"
It is possible to run arbitrary external programs or scripts (hooks) at
various stages of the backup process, to perform additional actions as part
of the backup process.
.PP
These scripts or symbolic links to executables should be placed in the
directory that the \fIhooksdir\fR configuration option points to
(\fI/usr/share/mylvmbackup\fR by default). They should return zero upon successful
completion, any non-zero return value will be considered a failure which will
be logged.
.PP
Hook scripts can also be implemented as Perl modules. The module must be named
\&\fIhookname.pm\fR and must be a package of type \fIhookname\fR. The module must
implement \fI\fIexecute()\fI\fR which is called by mylvmbackup to initiate the hook. It
must return boolean true/false (1 or 0) on success/failure. \fI\fIexecute()\fI\fR will
be passed 2 parameters. The first parameter is a \fIclone()\fR of the global database
handle \f(CW$dbh\fR. This will allow hook scripts to interact with the database using
the established connection. The second parameter is a string containing any
messages passed to the \fI\fIrun_hook()\fI\fR function. The module must also implement
\&\fI\fIerrmsg()\fI\fR which will return a string error message to be sent to
\&\fI\fIlog_msg()\fI\fR. This will be called by \fImylvmbackup\fR when \fI\fIexecute()\fI\fR returns
false/0.
.PP
The names of the scripts or symbolic links reflect the stage in which the hook
will be called. Currently, the following stages exist:
.IP "\fBpreconnect\fR" 4
.IX Item "preconnect"
before a connection to the database server is established
.IP "\fBpreflush\fR" 4
.IX Item "preflush"
before calling \s-1FLUSH\s0 \s-1TABLES\s0
.IP "\fBpresnapshot\fR" 4
.IX Item "presnapshot"
before the file system snapshot is created
.IP "\fBpreunlock\fR" 4
.IX Item "preunlock"
before the database tables are unlocked again
.IP "\fBpredisconnect\fR" 4
.IX Item "predisconnect"
before the connection to the database server is released
.IP "\fBpremount\fR" 4
.IX Item "premount"
before the snapshot volume is mounted
.IP "\fBprebackup\fR" 4
.IX Item "prebackup"
before the snapshot backup will be performed
.IP "\fBbackupsuccess\fR" 4
.IX Item "backupsuccess"
after a successful backup
.IP "\fBbackupfailure\fR" 4
.IX Item "backupfailure"
after a failed backup
.IP "\fBlogerr\fR" 4
.IX Item "logerr"
when an error is logged
.IP "\fBprecleanup\fR" 4
.IX Item "precleanup"
before the snapshot is unmounted and discarded
.PP
These hooks are optional and will only be called if a file for the particular
stage exists and is executable. Note that hooks implemented as Perl modules
(\fIhookname.pm\fR) have priority over \*(L"plain\*(R" hook scripts (\fIhookname\fR), if both
exist, only the first one will be used. The execution of all hooks can be
suppressed by passing the \fI\-\-skip_hooks\fR option or by setting the
\&\fIskip_hooks\fR configuration option to \fI1\fR;
.SH "OPTIONS"
.IX Header "OPTIONS"
mylvmbackup supports the following command line options. The same options can
also be defined in the \fI/etc/mylvmbackup.conf\fR configuration file (omitting
the leading dashes, of course). A sample configuration file is included in
the distribution.
.IP "\fB\-\-user=string\fR" 4
.IX Item "--user=string"
Specifies the username to use for connecting to the MySQL server.
The default is \fIroot\fR.
.IP "\fB\-\-password=string\fR" 4
.IX Item "--password=string"
Specifies the password to use for connecting to the MySQL server.
The default is the empty string (no password).
.IP "\fB\-\-host=string\fR" 4
.IX Item "--host=string"
Specifies the host name to use for connecting to the MySQL server. Note that
mylvmbackup needs to be run on the same system that the MySQL server to be
backed up runs on \- do not enter a remote host's host name or \s-1IP\s0 address here!
A non-empty value for \fIhost\fR other than \fIlocalhost\fR overrides any given
\&\fIsocket\fR path value.
The default is the empty string.
.IP "\fB\-\-port=number\fR" 4
.IX Item "--port=number"
Specifies the \s-1TCP\s0 port number to use for connecting to the MySQL server.
This value is only honoured, if \fIhost\fR is provided as well and is not
equal to \fIlocalhost\fR.
The default is the empty string.
.IP "\fB\-\-socket=string\fR" 4
.IX Item "--socket=string"
Specifies the path to the local socket file, if it is not located at the
default location. The default is the empty string.
.IP "\fB\-\-quiet\fR" 4
.IX Item "--quiet"
Suppresses logging of informal messages. Warnings and errors will still
be printed or logged (depending on the selected logging mechanism).
The default is verbose logging.
.IP "\fB\-\-innodb_recover\fR" 4
.IX Item "--innodb_recover"
Run InnoDB recovery on the writable snapshot prior to performing the backup.
.IP "\fB\-\-skip_flush_tables\fR" 4
.IX Item "--skip_flush_tables"
Don't issue a \fI\s-1FLUSH\s0 \s-1TABLES\s0 \s-1WITH\s0 \s-1READ\s0 \s-1LOCK\s0\fR command before creating
the snapshot. Only use this option when backing up InnoDB tables (as
they don't support this function anyway and will require recovery in
any case). This option skips the (probably time consuming) flushing
of buffers.
.IP "\fB\-\-extra_flush_tables\fR" 4
.IX Item "--extra_flush_tables"
If your database performs a lot of writes, it may help to perform an
extra initial \fI\s-1FLUSH\s0 \s-1TABLES\s0\fR so that the \fIlvcreate\fR can finish within
the interactivity timeout during the read-locked flush.
.IP "\fB\-\-pidfile=string\fR" 4
.IX Item "--pidfile=string"
Specifies the full path and file name to the \s-1PID\s0 file of the server instance
that is spawned to perform the InnoDB recovery (see option
\&\fI\-\-innodb_recover\fR). Must be different from the \s-1PID\s0 file that the actual
running server uses.
The default is \fI/var/tmp/mylvmbackup_recoverserver.pid\fR
.IP "\fB\-\-lvcreate=string\fR" 4
.IX Item "--lvcreate=string"
Specifies the pathname for the \fIlvcreate\fR program.
The default is \fIlvcreate\fR.
.IP "\fB\-\-lvremove=string\fR" 4
.IX Item "--lvremove=string"
Specifies the pathname for the \fIlvremove\fR program.
The default is \fIlvremove\fR.
.IP "\fB\-\-lvs=string\fR" 4
.IX Item "--lvs=string"
Specifies the pathname for the \fIlvs\fR program.
The default is \fIlvs\fR.
.IP "\fB\-\-mysqld_safe=string\fR" 4
.IX Item "--mysqld_safe=string"
Specifies the pathname for the \fImysqld_safe\fR program.
The default is \fImysqld_safe\fR.
Only used to perform InnoDB recovery.
.IP "\fB\-\-mycnf=string\fR" 4
.IX Item "--mycnf=string"
Specifies the name of the MySQL config file to include in the backup.
The default is \fI/etc/my.cnf\fR.
.IP "\fB\-\-skip_mycnf\fR" 4
.IX Item "--skip_mycnf"
Skip backing up the MySQL configuration file.
The default is to include a copy of the configuration file in the backup.
.IP "\fB\-\-hooksdir=string\fR" 4
.IX Item "--hooksdir=string"
The location of external scripts or executable to be called during various
stages of the backup. See the \s-1HOOKS\s0 section in this manual page for more
info.
The default is \fI/usr/share/mylvmbackup\fR.
.IP "\fB\-\-skip_hooks\fR" 4
.IX Item "--skip_hooks"
Skip invoking any external hooks during the backup.
.IP "\fB\-\-vgname=string\fR" 4
.IX Item "--vgname=string"
Specifies the volume group of the logical volume where the MySQL
data directory is located.
The default is \fImysql\fR.
.IP "\fB\-\-lvname=string\fR" 4
.IX Item "--lvname=string"
Specifies the name of the logical volume where the MySQL data
directory is located.
The default is \fIdata\fR.
.IP "\fB\-\-backuplv=string\fR" 4
.IX Item "--backuplv=string"
Specifies the name of the logical volume for the snapshot volume.
The default is appending \fB_snapshot\fR to the lvname.
.IP "\fB\-\-keep_snapshot\fR" 4
.IX Item "--keep_snapshot"
If this option is given, mylvmbackup will not remove the snapshot
before terminating. Note that keeping multiple \s-1LVM\s0 snapshots open at
the same time can reduce I/O performance and you will need to manually
discard the snapshot before invoking mylvmbackup again.
.IP "\fB\-\-keep_mount\fR" 4
.IX Item "--keep_mount"
If this option is given, mylvmbackup will not remove the mounted partition
before terminating. This option also implies \fIkeep_snapshot=1\fR, as it would
not be useful if the snapshot is removed. You need to manually unmount this
directory before invoking mylvmbackup again.
.IP "\fB\-\-relpath=string\fR" 4
.IX Item "--relpath=string"
Relative path on the logical volume to the MySQL data directory (no leading or
trailing slash). Example: the logical volume is mounted on \fI/var/lib\fR, but the
MySQL data directory is /var/lib/mysql. In this case, \fIrelpath\fR should be set
to \fImysql\fR.
The default is the empty string.
.IP "\fB\-\-lvsize=string\fR" 4
.IX Item "--lvsize=string"
Specifies the size for the snapshot volume.
The default is \fI5G\fR (5 gigabytes).
.IP "\fB\-\-backuptype=string\fR" 4
.IX Item "--backuptype=string"
Specifies what type of backup to perform. The available options are
\&\fItar\fR, \fIrsync\fR, \fIrsnap\fR and \fInone\fR.
.IP "\fB\-\-prefix=string\fR" 4
.IX Item "--prefix=string"
Prefix added to the backup file names. It is also appended to
the name of the directory used to mount the snapshot volume.
The default value is \fIbackup\fR.
.IP "\fB\-\-suffix=string\fR" 4
.IX Item "--suffix=string"
Suffix added to the backup file names (after the time stamp).
The default value is \fI_mysql\fR.
.IP "\fB\-\-datefmt=string\fR" 4
.IX Item "--datefmt=string"
Format of the time stamp included in the backup file name. See
the \fIDate::Format\fR perldoc page for a description of the format.
The default value is \fI\f(CI%Y\fI%m%d_%H%M%S\fR, which creates a time stamp
like \fI\s-1YYYYMMDD_HHMMSS\s0\fR, e.g. \fI20070531_112549\fR
.IP "\fB\-\-mountdir=string\fR" 4
.IX Item "--mountdir=string"
Path for mounting the snapshot volume to.
The default value is \fI/var/tmp/mylvmbackup/mnt/\fR.
If the directory does not exist, it will be created.
.Sp
It is possible to use selected \fI\fItimestr()\fI\fR formatting sequences to create
directory names which contain a dynamic date value. Currently, the following
format strings are supported:
\&\fI\f(CI%Y\fI\fR 4\-digit year (e.g. 2009),
\&\fI\f(CI%m\fI\fR month (01..12),
\&\fI\f(CI%d\fI\fR day of month, leading zero
\&\fI\f(CI%h\fI\fR month abbreviation,
\&\fI\f(CI%H\fI\fR hour, 24 hour clock, leading zero
\&\fI\f(CI%M\fI\fR minute, leading zero
\&\fI\f(CI%S\fI\fR seconds, leading zero
Example: \fI\f(CI$mountdir\fI=/path/to/%Y\-%m\-%d\fR will expand to \fI/path/to/2009\-06\-13\fR
.IP "\fB\-\-backupdir=string\fR" 4
.IX Item "--backupdir=string"
Specifies the pathname of the directory where the archive files will be written
to. The backup directory must not be on the same volume as the MySQL data
directory. If the directory does not exist, it will be created.
.Sp
It is possible to use selected \fI\fItimestr()\fI\fR formatting sequences to create
directory names which contain a dynamic date value. Currently, the following
format strings are supported:
\&\fI\f(CI%Y\fI\fR 4\-digit year (e.g. 2009),
\&\fI\f(CI%m\fI\fR month (01..12),
\&\fI\f(CI%d\fI\fR day of month, leading zero
\&\fI\f(CI%h\fI\fR month abbreviation,
\&\fI\f(CI%H\fI\fR hour, 24 hour clock, leading zero
\&\fI\f(CI%M\fI\fR minute, leading zero
\&\fI\f(CI%S\fI\fR seconds, leading zero
Example: \fI\f(CI$mountdir\fI=/path/to/%Y\-%m\-%d\fR will expand to \fI/path/to/2009\-06\-13\fR
.Sp
Instead of a local directory, you can also provide a valid rsync \s-1URL\s0 here, e.g.
\&\fIusername@hostname:/path\fR, \fIhostname:path\fR or \fIhostname::rsync\-module/path\fR.
This requires a properly configured remote rsync setup (e.g. pre-setup \s-1SSH\s0 keys
or a working rsyncd configuration).
.Sp
The default is \fI/var/tmp/mylvmbackup/backup/\fR
.IP "\fB\-\-mount=string\fR" 4
.IX Item "--mount=string"
Specifies the pathname for the \fImount\fR program.
The default is \fImount\fR.
.IP "\fB\-\-umount=string\fR" 4
.IX Item "--umount=string"
Specifies the pathname for the \fIumount\fR program.
The default is \fIumount\fR.
.IP "\fB\-\-tar=string\fR" 4
.IX Item "--tar=string"
Specifies the pathname for the \fItar\fR program.
The default is \fItar\fR.
.IP "\fB\-\-tararg=string\fR" 4
.IX Item "--tararg=string"
Specifies the initial arguments for the \fItar\fR program.
The default is \fIcvf\fR.
.IP "\fB\-\-tarsuffixarg=string\fR" 4
.IX Item "--tarsuffixarg=string"
Specifies the suffix arguments for the \fItar\fR program.
The default is the empty string.
To exclude a database, you would pass \fI\-\-exclude dbname\fR here.
.IP "\fB\-\-tarfilesuffix=string\fR" 4
.IX Item "--tarfilesuffix=string"
Specifies the suffix for the tarball.
The default is \fI.tar.gz\fR.
.IP "\fB\-\-compress=string\fR" 4
.IX Item "--compress=string"
Specifies the name of the compression program. Only used if \fIbackuptype\fR is
set to \fItar\fR. Some possibilities are \fIgzip\fR, \fIbzip2\fR or \fIlzma\fR.
The program must support reading the to be compressed data from \fIstdin\fR and
writing to \fIstdout\fR, without requiring intermediate temporary files (for this
reason, 7zip cannot be used). It's also possible to use \fIcat\fR. In this case,
no compression will be done. Make sure to update the \fIcompressarg\fR option
accordingly.
The default is \fIgzip\fR. Can be left empty.
.IP "\fB\-\-compressarg=string\fR" 4
.IX Item "--compressarg=string"
Specifies the command line options given to the \fIcompress\fR program. For \fIgzip\fR,
that would be \fI\-\-stdout \-\-verbose \-\-best\fR, for \fIlzma\fR or \fIbzip2\fR \fI\-\-stdout \-\-verbose \-7\fR
and for \fIcat\fR, it would be empty.
The default is \fI\-\-stdout \-\-verbose \-\-best\fR.
.IP "\fB\-\-rsnap=string\fR" 4
.IX Item "--rsnap=string"
Specifies the pathname for the \fIrsnap\fR program.
The default is \fIrsnap\fR.
.IP "\fB\-\-rsnaparg=string\fR" 4
.IX Item "--rsnaparg=string"
Specifies the arguments for the \fIrsnap\fR program.
The default is \fI7\fR, which causes it to keep the last 7 snapshot (useful
when running \fImylvmbackup\fR once per day).
.IP "\fB\-\-rsync=string\fR" 4
.IX Item "--rsync=string"
Specifies the pathname for the \fIrsync\fR program.
The default is \fIrsync\fR.
.IP "\fB\-\-rsyncarg=string\fR" 4
.IX Item "--rsyncarg=string"
Specifies the arguments for the \fIrsync\fR program.
The default is \fI\-avWP\fR. Should must ensure that the recursive option is
included either implicitly by \fI\-a\fR, or explicitly.
.IP "\fB\-\-xfs\fR" 4
.IX Item "--xfs"
Use the \fInouuid\fR mount option to safely mount snapshot partitions that
use the \s-1XFS\s0 file system.
.IP "\fB\-\-log_method=string\fR" 4
.IX Item "--log_method=string"
How to log output from this script. Valid options are \fIconsole\fR, \fIsyslog\fR
or \fIboth\fR.
The default value is \fIconsole\fR.
.IP "\fB\-\-syslog_socktype=string\fR" 4
.IX Item "--syslog_socktype=string"
What type of socket to use for connecting to the syslog service. Valid
options are \fInative\fR, \fItcp\fR and \fIudp\fR.
The default value is \fInative\fR.
.IP "\fB\-\-syslog_facility=string\fR" 4
.IX Item "--syslog_facility=string"
Define a particular syslog facility
Default value is the empty string.
.IP "\fB\-\-syslog_remotehost=string\fR" 4
.IX Item "--syslog_remotehost=string"
Host name of a remote syslog server.
.IP "\fB\-\-configfile=string\fR" 4
.IX Item "--configfile=string"
Specify an alternative configuration file.
The default is \fI/etc/mylvmbackup.conf\fR.
.IP "\fB\-\-help\fR" 4
.IX Item "--help"
Displays a help message showing the available options.
.SH "FILES"
.IX Header "FILES"
.IP "\fB/etc/mylvbackup.conf\fR" 4
.IX Item "/etc/mylvbackup.conf"
The \fImylvmbackup\fR configuration file
.IP "\fBmylvmbackup\fR" 4
.IX Item "mylvmbackup"
The executable Perl script that performs the work.
.SH "REQUIREMENTS"
.IX Header "REQUIREMENTS"
For proper operation \fImylvmbackup\fR requires Perl 5 with the \fI\s-1DBI\s0\fR and
\&\fIDBD::mysql\fR modules. It also needs the \fIConfig::IniFiles\fR to read the global
configuration file of the program and \fISys::Syslog\fR in case you want to enable
the syslog log facility. \fIDate::Format\fR is required to create the time stamp
used in the backup file names. In addition, it utilizes \fIGetopt::Long\fR,
\&\fIFile::Basename\fR and \fIFile::Temp\fR, which usually are part of the default Perl
distribution.
.PP
It also requires several other external programs: \s-1GNU\s0 \fItar\fR and \fIgzip\fR to back
up the data, \s-1LVM\s0 utilities (\fIlvcreate\fR, \fIlvremove\fR and \fIlvs\fR) to create and
remove the \s-1LVM\s0 snapshot, and the system utilities \fImount\fR and \fIumount\fR.
Please note that mylvmbackup requires Linux \s-1LVM\s0 Version 2 or higher. It does not
work on LVMv1, as this version does not support writable snapshots.
.PP
Optionally, \fIrsync\fR or \fIrsnap\fR may be required instead of \fItar\fR and \fIgzip\fR,
depending on which backup type you choose.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fImount\fR\|(8), \fItar\fR\|(1), \fIlvcreate\fR\|(8), \fIlvremove\fR\|(8), \fIlvs\fR\|(8), \fIumount\fR\|(8), \fIrsync\fR\|(1)
.SH "AUTHOR"
.IX Header "AUTHOR"
This program was initially written by Aleksey \*(L"Walrus\*(R" Kishkin from
MySQL \s-1AB\s0, with suggestions from Peter Zaitsev and Lenz Grimmer.
.PP
It is currently maintained by Lenz Grimmer, <lenz@grimmer.com>
.SH "RESOURCES"
.IX Header "RESOURCES"
Main web site: http://www.lenzg.net/mylvmbackup
.PP
Mailing list: https://launchpad.net/~mylvmbackup\-discuss
.PP
Source code, bug tracker: https://launchpad.net/mylvmbackup
.SH "CREDITS"
.IX Header "CREDITS"
See the file \s-1CREDITS\s0 included in the distribution for a list of individual
contributors.
.SH "COPYING"
.IX Header "COPYING"
mylvmbackup is distributed under the \s-1GNU\s0 public license. See the file
\&\s-1COPYING\s0 for details.
|