Jiri Broulik | 634ea8a | 2017-05-31 17:10:03 +0200 | [diff] [blame] | 1 | |
| 2 | =================== |
| 3 | xtrabackup formula |
| 4 | =================== |
| 5 | |
| 6 | Xtrabackup allows you to backup and restore databases from full backups or full backups and its incrementals. |
| 7 | |
| 8 | |
| 9 | Sample pillars |
| 10 | ============== |
| 11 | |
| 12 | Backup client with ssh/rsync remote host |
| 13 | |
| 14 | .. code-block:: yaml |
| 15 | |
| 16 | xtrabackup: |
| 17 | client: |
| 18 | enabled: true |
| 19 | full_backups_to_keep: 3 |
| 20 | hours_before_full: 48 |
| 21 | hours_before_incr: 12 |
| 22 | database: |
| 23 | user: username |
| 24 | password: password |
| 25 | target: |
| 26 | host: cfg01 |
| 27 | |
| 28 | .. note:: full_backups_to_keep param states how many backup will be stored locally on xtrabackup client. |
| 29 | More options to relocate local backups can be done using salt-formula-backupninja. |
| 30 | |
| 31 | |
| 32 | Backup client with local backup only |
| 33 | |
| 34 | .. code-block:: yaml |
| 35 | |
| 36 | xtrabackup: |
| 37 | client: |
| 38 | enabled: true |
| 39 | full_backups_to_keep: 3 |
| 40 | hours_before_full: 48 |
| 41 | hours_before_incr: 12 |
| 42 | database: |
| 43 | user: username |
| 44 | password: password |
| 45 | |
| 46 | .. note:: full_backups_to_keep param states how many backup will be stored locally on xtrabackup client |
| 47 | |
| 48 | |
Marcin Iwinski | f74b953 | 2017-09-28 16:30:47 +0200 | [diff] [blame] | 49 | Backup client with ssh/rsync to remote host with compression and non-default backup directory on server: |
Jiri Broulik | 634ea8a | 2017-05-31 17:10:03 +0200 | [diff] [blame] | 50 | |
| 51 | .. code-block:: yaml |
| 52 | |
| 53 | xtrabackup: |
| 54 | client: |
| 55 | enabled: true |
| 56 | full_backups_to_keep: 3 |
| 57 | hours_before_full: 48 |
| 58 | hours_before_incr: 12 |
| 59 | compression: true |
| 60 | compression_threads: 2 |
| 61 | database: |
| 62 | user: username |
| 63 | password: password |
| 64 | target: |
| 65 | host: cfg01 |
Marcin Iwinski | f74b953 | 2017-09-28 16:30:47 +0200 | [diff] [blame] | 66 | server: |
| 67 | enabled: false |
| 68 | backup_dir: /srv/backup |
Jiri Broulik | 634ea8a | 2017-05-31 17:10:03 +0200 | [diff] [blame] | 69 | |
| 70 | .. note:: More options to relocate local backups can be done using salt-formula-backupninja. |
| 71 | |
Marcin Iwinski | f74b953 | 2017-09-28 16:30:47 +0200 | [diff] [blame] | 72 | .. note:: If the ``server`` section is ommited backups will be made to |
| 73 | default location, same on both client and server side. |
Jiri Broulik | 634ea8a | 2017-05-31 17:10:03 +0200 | [diff] [blame] | 74 | |
Marcin Iwinski | f74b953 | 2017-09-28 16:30:47 +0200 | [diff] [blame] | 75 | |
| 76 | Backup server rsync and non-default backup directory: |
Jiri Broulik | 634ea8a | 2017-05-31 17:10:03 +0200 | [diff] [blame] | 77 | |
| 78 | .. code-block:: yaml |
| 79 | |
| 80 | xtrabackup: |
| 81 | server: |
| 82 | enabled: true |
| 83 | hours_before_full: 48 |
| 84 | full_backups_to_keep: 5 |
| 85 | key: |
| 86 | xtrabackup_pub_key: |
| 87 | enabled: true |
| 88 | key: key |
Marcin Iwinski | f74b953 | 2017-09-28 16:30:47 +0200 | [diff] [blame] | 89 | backup_dir: /srv/backup |
Jiri Broulik | 634ea8a | 2017-05-31 17:10:03 +0200 | [diff] [blame] | 90 | |
| 91 | .. note:: hours_before_full param should have the same value as is stated on xtrabackup client |
| 92 | |
Marcin Iwinski | f74b953 | 2017-09-28 16:30:47 +0200 | [diff] [blame] | 93 | .. note:: If the ``backup_dir`` argument is ommited backups will be made to |
| 94 | default location, same on both client and server side. |
Jiri Broulik | 634ea8a | 2017-05-31 17:10:03 +0200 | [diff] [blame] | 95 | |
Jiri Broulik | e662620 | 2018-02-28 16:22:20 +0100 | [diff] [blame^] | 96 | |
| 97 | Backup server without strict client restriction |
| 98 | |
| 99 | .. code-block:: yaml |
| 100 | |
| 101 | xtrabackup: |
| 102 | server: |
| 103 | restrict_clients: false |
| 104 | |
| 105 | Client restore from local backups: |
Jiri Broulik | 634ea8a | 2017-05-31 17:10:03 +0200 | [diff] [blame] | 106 | |
| 107 | .. code-block:: yaml |
| 108 | |
| 109 | xtrabackup: |
| 110 | client: |
| 111 | enabled: true |
| 112 | full_backups_to_keep: 5 |
| 113 | hours_before_full: 48 |
| 114 | hours_before_incr: 12 |
| 115 | restore_full_latest: 1 |
| 116 | restore_from: local |
| 117 | compression: true |
| 118 | compressThreads: 2 |
| 119 | database: |
| 120 | user: username |
| 121 | password: password |
| 122 | target: |
| 123 | host: cfg01 |
| 124 | qpress: |
| 125 | source: tar |
| 126 | name: url |
| 127 | |
| 128 | .. note:: restore_full_latest param with a value of 1 means to restore db from the last full backup and its increments. 2 would mean to restore second latest full backup and its increments |
| 129 | |
| 130 | |
| 131 | Client restore from remote backups: |
| 132 | |
| 133 | .. code-block:: yaml |
| 134 | |
| 135 | xtrabackup: |
| 136 | client: |
| 137 | enabled: true |
| 138 | full_backups_to_keep: 5 |
| 139 | hours_before_full: 48 |
| 140 | hours_before_incr: 12 |
| 141 | restore_full_latest: 1 |
| 142 | restore_from: remote |
| 143 | compression: true |
| 144 | compressThreads: 2 |
| 145 | database: |
| 146 | user: username |
| 147 | password: password |
| 148 | target: |
| 149 | host: cfg01 |
| 150 | qpress: |
| 151 | source: tar |
| 152 | name: url |
| 153 | |
| 154 | .. note:: restore_full_latest param with a value of 1 means to restore db from the last full backup and its increments. 2 would mean to restore second latest full backup and its increments |
| 155 | |
| 156 | |
| 157 | More information |
| 158 | ================ |
| 159 | |
| 160 | * https://labs.riseup.net/code/projects/xtrabackup/wiki/Configuration |
| 161 | * http://www.debian-administration.org/articles/351 |
| 162 | * http://duncanlock.net/blog/2013/08/27/comprehensive-linux-backups-with-etckeeper-xtrabackup/ |
| 163 | * https://github.com/riseuplabs/puppet-xtrabackup |
| 164 | * http://www.ushills.co.uk/2008/02/backup-with-xtrabackup.html |
| 165 | |
| 166 | |
| 167 | Documentation and Bugs |
| 168 | ====================== |
| 169 | |
| 170 | To learn how to install and update salt-formulas, consult the documentation |
| 171 | available online at: |
| 172 | |
| 173 | http://salt-formulas.readthedocs.io/ |
| 174 | |
| 175 | In the unfortunate event that bugs are discovered, they should be reported to |
| 176 | the appropriate issue tracker. Use Github issue tracker for specific salt |
| 177 | formula: |
| 178 | |
| 179 | https://github.com/salt-formulas/salt-formula-xtrabackup/issues |
| 180 | |
| 181 | For feature requests, bug reports or blueprints affecting entire ecosystem, |
| 182 | use Launchpad salt-formulas project: |
| 183 | |
| 184 | https://launchpad.net/salt-formulas |
| 185 | |
| 186 | You can also join salt-formulas-users team and subscribe to mailing list: |
| 187 | |
| 188 | https://launchpad.net/~salt-formulas-users |
| 189 | |
| 190 | Developers wishing to work on the salt-formulas projects should always base |
| 191 | their work on master branch and submit pull request against specific formula. |
| 192 | |
| 193 | https://github.com/salt-formulas/salt-formula-xtrabackup |
| 194 | |
| 195 | Any questions or feedback is always welcome so feel free to join our IRC |
| 196 | channel: |
| 197 | |
| 198 | #salt-formulas @ irc.freenode.net |
| 199 | |