blob: a7e0b72ee0850bfe00292350d6715ce849b8341a [file] [log] [blame]
Jiri Broulik634ea8a2017-05-31 17:10:03 +02001
2===================
3xtrabackup formula
4===================
5
6Xtrabackup allows you to backup and restore databases from full backups or full backups and its incrementals.
7
8
9Sample pillars
10==============
11
12Backup 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
32Backup 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 Iwinskif74b9532017-09-28 16:30:47 +020049Backup client with ssh/rsync to remote host with compression and non-default backup directory on server:
Jiri Broulik634ea8a2017-05-31 17:10:03 +020050
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 Iwinskif74b9532017-09-28 16:30:47 +020066 server:
67 enabled: false
68 backup_dir: /srv/backup
Jiri Broulik634ea8a2017-05-31 17:10:03 +020069
70 .. note:: More options to relocate local backups can be done using salt-formula-backupninja.
71
Marcin Iwinskif74b9532017-09-28 16:30:47 +020072 .. note:: If the ``server`` section is ommited backups will be made to
73 default location, same on both client and server side.
Jiri Broulik634ea8a2017-05-31 17:10:03 +020074
Marcin Iwinskif74b9532017-09-28 16:30:47 +020075
Martin Polreichf33e1862018-03-02 10:30:35 +010076Backup client at exact times:
77
78..code-block:: yaml
79
80 xtrabackup:
81 client:
82 enabled: true
83 full_backups_to_keep: 3
84 incr_before_full: 3
85 backup_dir: /var/backups/mysql/xtrabackup
86 backup_times:
87 dayOfWeek: 0
88 hour: 4
89 minute: 52
90 compression: true
91 compression_threads: 2
92 database:
93 user: user
94 password: password
95 target:
96 host: host01
97
98 .. note:: Parameters in ``backup_times`` section can be used to set up exact
99 time the cron job should be executed. In this example, the backup job
100 would be executed every Sunday at 4:52 AM. If any of the individual
101 ``backup_times`` parameters is not defined, the defalut ``*`` value will be
102 used. For example, if minute parameter is ``*``, it will run the backup every minute,
103 which is ususally not desired.
104 Available parameters are ``dayOfWeek``, ``dayOfMonth``, ``month``, ``hour`` and ``minute``.
105 Please see the crontab reference for further info on how to set these parameters.
106
107 .. note:: Please be aware that only ``backup_times`` section OR
108 ``hours_before_full(incr)`` can be defined. If both are defined, The
109 ``backup_times`` section will be peferred.
110
111 .. note:: New parameter ``incr_before_full`` needs to be defined. This
112 number sets number of incremental backups to be run, before a full backup
113 is performed.
114
115
Marcin Iwinskif74b9532017-09-28 16:30:47 +0200116Backup server rsync and non-default backup directory:
Jiri Broulik634ea8a2017-05-31 17:10:03 +0200117
118.. code-block:: yaml
119
120 xtrabackup:
121 server:
122 enabled: true
123 hours_before_full: 48
124 full_backups_to_keep: 5
125 key:
126 xtrabackup_pub_key:
127 enabled: true
128 key: key
Marcin Iwinskif74b9532017-09-28 16:30:47 +0200129 backup_dir: /srv/backup
Jiri Broulik634ea8a2017-05-31 17:10:03 +0200130
131 .. note:: hours_before_full param should have the same value as is stated on xtrabackup client
132
Marcin Iwinskif74b9532017-09-28 16:30:47 +0200133 .. note:: If the ``backup_dir`` argument is ommited backups will be made to
134 default location, same on both client and server side.
Jiri Broulik634ea8a2017-05-31 17:10:03 +0200135
Jiri Broulike6626202018-02-28 16:22:20 +0100136
137Backup server without strict client restriction
138
139.. code-block:: yaml
140
141 xtrabackup:
142 server:
143 restrict_clients: false
144
Martin Polreichf33e1862018-03-02 10:30:35 +0100145
146Backup server at exact times:
147
148..code-block:: yaml
149
150 xtrabackup:
151 server:
152 enabled: true
153 full_backups_to_keep: 3
154 incr_before_full: 3
155 backup_dir: /srv/backup
156 backup_times:
157 dayOfWeek: 0
158 hour: 4
159 minute: 52
160 key:
161 xtrabackup_pub_key:
162 enabled: true
163 key: key
164
165 .. note:: Parameters in ``backup_times`` section can be used to set up exact
166 time the cron job should be executed. In this example, the backup job
167 would be executed every Sunday at 4:52 AM. If any of the individual
168 ``backup_times`` parameters is not defined, the defalut ``*`` value will be
169 used. For example, if minute parameter is ``*``, it will run the backup every minute,
170 which is ususally not desired.
171 Please see the crontab reference for further info on how to set these parameters.
172
173 .. note:: Please be aware that only ``backup_times`` section OR
174 ``hours_before_full(incr)`` can be defined. If both are defined, The
175 ``backup_times`` section will be peferred.
176
177 .. note:: New parameter ``incr_before_full`` needs to be defined. This
178 number sets number of incremental backups to be run, before a full backup
179 is performed.
180
Jiri Broulike6626202018-02-28 16:22:20 +0100181Client restore from local backups:
Jiri Broulik634ea8a2017-05-31 17:10:03 +0200182
183.. code-block:: yaml
184
185 xtrabackup:
186 client:
187 enabled: true
188 full_backups_to_keep: 5
189 hours_before_full: 48
190 hours_before_incr: 12
191 restore_full_latest: 1
192 restore_from: local
193 compression: true
194 compressThreads: 2
195 database:
196 user: username
197 password: password
198 target:
199 host: cfg01
200 qpress:
201 source: tar
202 name: url
203
204 .. 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
205
206
207Client restore from remote backups:
208
209.. code-block:: yaml
210
211 xtrabackup:
212 client:
213 enabled: true
214 full_backups_to_keep: 5
215 hours_before_full: 48
216 hours_before_incr: 12
217 restore_full_latest: 1
218 restore_from: remote
219 compression: true
220 compressThreads: 2
221 database:
222 user: username
223 password: password
224 target:
225 host: cfg01
226 qpress:
227 source: tar
228 name: url
229
230 .. 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
231
232
233More information
234================
235
236* https://labs.riseup.net/code/projects/xtrabackup/wiki/Configuration
237* http://www.debian-administration.org/articles/351
238* http://duncanlock.net/blog/2013/08/27/comprehensive-linux-backups-with-etckeeper-xtrabackup/
239* https://github.com/riseuplabs/puppet-xtrabackup
240* http://www.ushills.co.uk/2008/02/backup-with-xtrabackup.html
241
242
243Documentation and Bugs
244======================
245
246To learn how to install and update salt-formulas, consult the documentation
247available online at:
248
249 http://salt-formulas.readthedocs.io/
250
251In the unfortunate event that bugs are discovered, they should be reported to
252the appropriate issue tracker. Use Github issue tracker for specific salt
253formula:
254
255 https://github.com/salt-formulas/salt-formula-xtrabackup/issues
256
257For feature requests, bug reports or blueprints affecting entire ecosystem,
258use Launchpad salt-formulas project:
259
260 https://launchpad.net/salt-formulas
261
262You can also join salt-formulas-users team and subscribe to mailing list:
263
264 https://launchpad.net/~salt-formulas-users
265
266Developers wishing to work on the salt-formulas projects should always base
267their work on master branch and submit pull request against specific formula.
268
269 https://github.com/salt-formulas/salt-formula-xtrabackup
270
271Any questions or feedback is always welcome so feel free to join our IRC
272channel:
273
274 #salt-formulas @ irc.freenode.net
275