blob: cffadc8d79cdc51e74209e8bbeca684500388808 [file] [log] [blame]
Jiri Broulik634ea8a2017-05-31 17:10:03 +02001
2===================
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +03003Usage
Jiri Broulik634ea8a2017-05-31 17:10:03 +02004===================
5
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +03006Xtrabackup allows you to backup and restore databases from full
7backups or full backups and its incrementals.
Jiri Broulik634ea8a2017-05-31 17:10:03 +02008
9Sample pillars
10==============
11
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +030012Backup client with ssh/rsync remote host:
Jiri Broulik634ea8a2017-05-31 17:10:03 +020013
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
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +030028.. note:: The ``full_backups_to_keep`` parameter states how many backup will
29 be stored locally on xtrabackup client. More options to relocate local
30 backups can be done using ``salt-formula-backupninja``.
Jiri Broulik634ea8a2017-05-31 17:10:03 +020031
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +030032Backup client with local backup only:
Jiri Broulik634ea8a2017-05-31 17:10:03 +020033
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
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +030046.. note:: The ``full_backups_to_keep`` parameter states how many backup will
47 be stored locally on xtrabackup client.
Jiri Broulik634ea8a2017-05-31 17:10:03 +020048
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +030049Backup client with ssh/rsync to remote host with compression and non-default
50backup directory on server:
Jiri Broulik634ea8a2017-05-31 17:10:03 +020051
52.. code-block:: yaml
53
54 xtrabackup:
55 client:
56 enabled: true
57 full_backups_to_keep: 3
58 hours_before_full: 48
59 hours_before_incr: 12
60 compression: true
61 compression_threads: 2
62 database:
63 user: username
64 password: password
65 target:
66 host: cfg01
Marcin Iwinskif74b9532017-09-28 16:30:47 +020067 server:
68 enabled: false
69 backup_dir: /srv/backup
Jiri Broulik634ea8a2017-05-31 17:10:03 +020070
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +030071.. note:: More options to relocate local backups can be done using
72 ``salt-formula-backupninja``.
Jiri Broulik634ea8a2017-05-31 17:10:03 +020073
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +030074.. note:: If the ``server`` section is ommited, backups will be made to
75 default location, same on both client and server side.
Marcin Iwinskif74b9532017-09-28 16:30:47 +020076
Martin Polreichf33e1862018-03-02 10:30:35 +010077Backup client at exact times:
78
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +030079.. code-block:: yaml
Martin Polreichf33e1862018-03-02 10:30:35 +010080
81 xtrabackup:
82 client:
83 enabled: true
84 full_backups_to_keep: 3
85 incr_before_full: 3
86 backup_dir: /var/backups/mysql/xtrabackup
87 backup_times:
Martin Polreich36948512018-04-04 10:07:58 +020088 day_of_week: 0
Martin Polreichf33e1862018-03-02 10:30:35 +010089 hour: 4
90 minute: 52
91 compression: true
92 compression_threads: 2
93 database:
94 user: user
95 password: password
96 target:
97 host: host01
98
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +030099.. note:: Parameters in ``backup_times`` section can be used to set up exact
100 time the cron job should be executed. In this example, the backup job
101 would be executed every Sunday at 4:52 AM. If any of the individual
102 ``backup_times`` parameters is not defined, the defalut ``*`` value will
103 be used. For example, if minute parameter is ``*``, it will run the backup
104 every minute, which is ususally not desired.
Martin Polreichf33e1862018-03-02 10:30:35 +0100105
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +0300106 Available parameters include:
Martin Polreichf33e1862018-03-02 10:30:35 +0100107
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +0300108 * ``day_of_week``
109 * ``day_of_month``
110 * ``month``
111 * ``hour``
112 * ``minute``.
Martin Polreichf33e1862018-03-02 10:30:35 +0100113
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +0300114 See the crontab reference for further info on how to set these
115 parameters.
116
117.. note:: Please be aware that only ``backup_times`` section OR
118 ``hours_before_full(incr)`` can be defined. If both are defined. The
119 ``backup_times`` section will be peferred.
120
121.. note:: New parameter ``incr_before_full`` needs to be defined. This
122 number sets number of incremental backups to be run, before a full backup
123 is performed.
Martin Polreichf33e1862018-03-02 10:30:35 +0100124
Marcin Iwinskif74b9532017-09-28 16:30:47 +0200125Backup server rsync and non-default backup directory:
Jiri Broulik634ea8a2017-05-31 17:10:03 +0200126
127.. code-block:: yaml
128
129 xtrabackup:
130 server:
131 enabled: true
132 hours_before_full: 48
133 full_backups_to_keep: 5
134 key:
135 xtrabackup_pub_key:
136 enabled: true
137 key: key
Marcin Iwinskif74b9532017-09-28 16:30:47 +0200138 backup_dir: /srv/backup
Jiri Broulik634ea8a2017-05-31 17:10:03 +0200139
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +0300140.. note:: The ``hours_before_full`` parameter should have the same value as
141 is stated on xtrabackup client
Jiri Broulik634ea8a2017-05-31 17:10:03 +0200142
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +0300143.. note:: If the ``backup_dir`` argument is ommited backups will be made to
144 default location, same on both client and server side.
Jiri Broulik634ea8a2017-05-31 17:10:03 +0200145
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +0300146Backup server without strict client restriction:
Jiri Broulike6626202018-02-28 16:22:20 +0100147
148.. code-block:: yaml
149
150 xtrabackup:
151 server:
152 restrict_clients: false
153
Martin Polreichf33e1862018-03-02 10:30:35 +0100154Backup server at exact times:
155
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +0300156.. code-block:: yaml
Martin Polreichf33e1862018-03-02 10:30:35 +0100157
158 xtrabackup:
159 server:
160 enabled: true
161 full_backups_to_keep: 3
162 incr_before_full: 3
163 backup_dir: /srv/backup
164 backup_times:
Martin Polreich36948512018-04-04 10:07:58 +0200165 day_of_week: 0
Martin Polreichf33e1862018-03-02 10:30:35 +0100166 hour: 4
167 minute: 52
168 key:
169 xtrabackup_pub_key:
170 enabled: true
171 key: key
172
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +0300173.. note:: Parameters in ``backup_times`` section can be used to set up exact
174 time the cron job should be executed. In this example, the backup job
175 would be executed every Sunday at 4:52 AM. If any of the individual
176 ``backup_times`` parameters is not defined, the defalut ``*`` value will
177 be used. For example, if minute parameter is ``*``, it will run the backup
178 every minute, which is ususally not desired.
Martin Polreichf33e1862018-03-02 10:30:35 +0100179
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +0300180 See the crontab reference for further info on how to set these parameters.
Martin Polreichf33e1862018-03-02 10:30:35 +0100181
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +0300182.. note:: Please be aware that only ``backup_times`` section OR
183 ``hours_before_full(incr)`` can be defined. If both are defined. The
184 ``backup_times`` section will be peferred.
185
186.. note:: New parameter ``incr_before_full`` needs to be defined. This
187 number sets number of incremental backups to be run, before a full backup
188 is performed.
Martin Polreichf33e1862018-03-02 10:30:35 +0100189
Jiri Broulike6626202018-02-28 16:22:20 +0100190Client restore from local backups:
Jiri Broulik634ea8a2017-05-31 17:10:03 +0200191
192.. code-block:: yaml
193
194 xtrabackup:
195 client:
196 enabled: true
197 full_backups_to_keep: 5
198 hours_before_full: 48
199 hours_before_incr: 12
200 restore_full_latest: 1
201 restore_from: local
202 compression: true
203 compressThreads: 2
204 database:
205 user: username
206 password: password
207 target:
208 host: cfg01
209 qpress:
210 source: tar
211 name: url
212
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +0300213.. note:: restore_full_latest param with a value of 1 means to restore
214 db from the last full backup and its increments. 2 would mean to
215 restore second latest full backup and its increments
Jiri Broulik634ea8a2017-05-31 17:10:03 +0200216
azvyagintsev83c4c642018-08-20 16:47:51 +0300217Client restore from remote backups:
Jiri Broulik634ea8a2017-05-31 17:10:03 +0200218
219.. code-block:: yaml
220
221 xtrabackup:
222 client:
223 enabled: true
224 full_backups_to_keep: 5
225 hours_before_full: 48
226 hours_before_incr: 12
227 restore_full_latest: 1
228 restore_from: remote
229 compression: true
230 compressThreads: 2
231 database:
232 user: username
233 password: password
234 target:
235 host: cfg01
236 qpress:
237 source: tar
238 name: url
239
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +0300240.. note:: The ``restore_full_latest`` parameter with a value of 1
241 means to restore db from the last full backup and its increments.
242 2 would mean to restore second latest full backup and its increments
Jiri Broulik634ea8a2017-05-31 17:10:03 +0200243
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +0300244Read more
245=========
Jiri Broulik634ea8a2017-05-31 17:10:03 +0200246
247* https://labs.riseup.net/code/projects/xtrabackup/wiki/Configuration
248* http://www.debian-administration.org/articles/351
249* http://duncanlock.net/blog/2013/08/27/comprehensive-linux-backups-with-etckeeper-xtrabackup/
250* https://github.com/riseuplabs/puppet-xtrabackup
251* http://www.ushills.co.uk/2008/02/backup-with-xtrabackup.html
252
Jiri Broulik634ea8a2017-05-31 17:10:03 +0200253Documentation and Bugs
254======================
255
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +0300256* http://salt-formulas.readthedocs.io/
257 Learn how to install and update salt-formulas
Jiri Broulik634ea8a2017-05-31 17:10:03 +0200258
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +0300259* https://github.com/salt-formulas/salt-formula-xtrabackup/issues
260 In the unfortunate event that bugs are discovered, report the issue to the
261 appropriate issue tracker. Use the Github issue tracker for a specific salt
262 formula
Jiri Broulik634ea8a2017-05-31 17:10:03 +0200263
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +0300264* https://launchpad.net/salt-formulas
265 For feature requests, bug reports, or blueprints affecting the entire
266 ecosystem, use the Launchpad salt-formulas project
Jiri Broulik634ea8a2017-05-31 17:10:03 +0200267
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +0300268* https://launchpad.net/~salt-formulas-users
269 Join the salt-formulas-users team and subscribe to mailing list if required
Jiri Broulik634ea8a2017-05-31 17:10:03 +0200270
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +0300271* https://github.com/salt-formulas/salt-formula-xtrabackup
272 Develop the salt-formulas projects in the master branch and then submit pull
273 requests against a specific formula
Jiri Broulik634ea8a2017-05-31 17:10:03 +0200274
OlgaGusarenkoa8a80d32018-07-31 01:31:34 +0300275* #salt-formulas @ irc.freenode.net
276 Use this IRC channel in case of any questions or feedback which is always
277 welcome
Jiri Broulik634ea8a2017-05-31 17:10:03 +0200278