Skip to content

Commit be838eb

Browse files
committed
MODULES-10023 add xtrabackup documentation
1 parent 7730e27 commit be838eb

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* [Install Percona server on CentOS](#install-percona-server-on-centos)
1515
* [Install MariaDB on Ubuntu](#install-mariadb-on-ubuntu)
1616
* [Install Plugins](#install-plugins)
17+
* [Use Percona XtraBackup](#use-percona-xtrabackup)
1718
4. [Reference - An under-the-hood peek at what the module is doing and how](REFERENCE.md)
1819
5. [Limitations - OS compatibility, etc.](#limitations)
1920
6. [Development - Guide for contributing to the module](#development)
@@ -389,6 +390,69 @@ mysql::server::db:
389390
### Install Plugins
390391

391392
Plugins can be installed by using the `mysql_plugin` defined type. See `examples/mysql_plugin.pp` for futher examples.
393+
394+
### Use Percona XtraBackup
395+
396+
This example shows how to configure MySQL backups with Percona XtraBackup. This sets up a weekly cronjob to perform a full backup and additional daily cronjobs for incremental backups. Each backup will create a new directory. A cleanup job will automatically remove backups that are older than 15 days.
397+
398+
```puppet
399+
yumrepo { 'percona':
400+
descr => 'CentOS $releasever - Percona',
401+
baseurl => 'http://repo.percona.com/release/$releasever/RPMS/$basearch',
402+
gpgkey => 'https://www.percona.com/downloads/RPM-GPG-KEY-percona https://repo.percona.com/yum/PERCONA-PACKAGING-KEY',
403+
enabled => 1,
404+
gpgcheck => 1,
405+
}
406+
407+
class { 'mysql::server::backup':
408+
backupuser => 'myuser',
409+
backuppassword => 'mypassword',
410+
backupdir => '/tmp/backups',
411+
provider => 'xtrabackup',
412+
rotate => 15,
413+
execpath => '/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin',
414+
time => ['23', '15'],
415+
}
416+
```
417+
418+
If the daily or weekly backup was successful, then the empty file `/tmp/mysqlbackup_success` is created, which makes it easy to monitor the status of the database backup.
419+
420+
After two weeks the backup directory should look similar to the example below.
421+
422+
```
423+
/tmp/backups/2019-11-10_full
424+
/tmp/backups/2019-11-11_23-15-01
425+
/tmp/backups/2019-11-13_23-15-01
426+
/tmp/backups/2019-11-13_23-15-02
427+
/tmp/backups/2019-11-14_23-15-01
428+
/tmp/backups/2019-11-15_23-15-02
429+
/tmp/backups/2019-11-16_23-15-01
430+
/tmp/backups/2019-11-17_full
431+
/tmp/backups/2019-11-18_23-15-01
432+
/tmp/backups/2019-11-19_23-15-01
433+
/tmp/backups/2019-11-20_23-15-02
434+
/tmp/backups/2019-11-21_23-15-01
435+
/tmp/backups/2019-11-22_23-15-02
436+
/tmp/backups/2019-11-23_23-15-01
437+
```
438+
439+
A drawback of using incremental backups is the need to keep at least 7 days of backups, otherwise the full backups is removed early and consecutive incremental backups will fail. Furthermore an incremental backups becomes obsolete once the required full backup was removed.
440+
441+
The next example uses XtraBackup with incremental backups disabled. In this case the daily cronjob will always perform a full backup.
442+
443+
```puppet
444+
class { 'mysql::server::backup':
445+
backupuser => 'myuser',
446+
backuppassword => 'mypassword',
447+
backupdir => '/tmp/backups',
448+
provider => 'xtrabackup',
449+
incremental_backups => false,
450+
rotate => 5,
451+
execpath => '/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin',
452+
time => ['23', '15'],
453+
}
454+
```
455+
392456
## Reference
393457

394458
### Classes

0 commit comments

Comments
 (0)