Skip to content
/ myxbackup Public

simple, cron-triggered backup script for MySQL Databases using Percona xtrabackup

License

Notifications You must be signed in to change notification settings

bbak/myxbackup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

myxbackup

simple, cron-triggered backup script for MySQL Databases using Percona xtrabackup

This is a simple Bash-Script trying to automate MySQL backups, using Persona's excellent xtrabackup.

It's intended to be run through CRON adding a crontab entry like this:

MAILTO=some.name@email.com
00 23 * * * root /path/to/script.sh -b /path/to/backups -d 4 -k 2 -u 4096 > /dev/null

This will create a full backup on day 4 (Option -d, 1 = Monday) of every week keeping 2 (Option -k) full weeks of backups in subdirectories of the path provided by option -b.

On all other days a incremental backup is done, if a corresponding full backup exists.

When passing option -u the scipt tries to set the open files limit (ulimit -n), which may be required, if you have many databases/tables - at least with Debian wheezy.

Old backups are automatically purged.

In case something goes wrong, an email is sent to the Adress provided in the crontab.

Since I don't want to pass around MySQL login & password in the shell, this script (in fact it's innobackupex) relies on a .my.cnf in the home directory of the user executing the script, keeping the login-credentials. It should look like this:

[client]
user="yourusername"
password="yourpassword"

Note: Recent MySQL Versions may be set up to use Socket Authentication. If the user used to execute this script is set up this way, you obviously don't need the .my.cnf.

This Script doesn't assist you in restoring backups. Read the innobackupex docs.

If you need more advanced backup solutions, try:

(thanx Alexey)

About

simple, cron-triggered backup script for MySQL Databases using Percona xtrabackup

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages