-
Notifications
You must be signed in to change notification settings - Fork 19
/
README
65 lines (48 loc) · 2.39 KB
/
README
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
xbackup.sh - Wrapper for Percona Xtrabackup
-------------------------------------------
REQUIREMENTS
------------
- Percona XtraBackup
- MySQL/compatible server (to backup)
- MySQL/compatible server (to store backup metadata)
CONFIGURATION
-------------
APPLY_LOG When set to 1, a copy of your backups will be maintained inside WORK_DIR/bkps
where they will be prepared with "--apply-log --redo-only". This process
is applied for the full backup set starting with the most recent full backup
and incremental backups if any. The resulting folder is prefixed with 'P_'.
See http://www.percona.com/doc/percona-xtrabackup/2.1/howtos/recipes_ibkx_inc.html
STOR_CMP Whether to compress your backups, although XtraBackup supports its own compression
the script only compresses using good ol' tarball for now.
COPY_BINLOGS Whether to maintain a copy of your binary logs as well. The number of binary logs
maintained depends on the oldest backup you have and the newest such that
you should be able to prepare your oldest backup and apply your binary logs up
to now. The bianry logs are stored inside STOR_DIR/bnlg
WORK_DIR If you have enabled APPLY_LOG and/or STOR_CMP, certain backup copies will be
kept here.
STOR_DIR Where your actual raw (optionally compressed) backups will be stored.
MY Must be set to the command line needed to access the metadata server
(i.e. "mysql -uuser -ppass -hhost schema-name")
The following table must exist in the schema specified in the MY variable:
CREATE TABLE backups (
id int(10) unsigned NOT NULL auto_increment,
started_at timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
ends_at timestamp NOT NULL default '0000-00-00 00:00:00',
size varchar(15) default NULL,
path varchar(120) default NULL,
type enum('full','incr') NOT NULL default 'full',
incrbase timestamp NOT NULL default '0000-00-00 00:00:00',
weekno tinyint(3) unsigned NOT NULL default '0',
baseid int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
USAGE EXAMPLES
--------------
Create a full backup with:
bash xbackup.sh -t full
Create an incremental backup with:
bash xbackup.sh -t incr
In case of a previous error and lock file was not removed, you can add -f to force the backup
and remove the lock file afterwards. Note that you have to be sure you have already
investigated the cause of the previous failure.
bash xbackup.sh -t full -f