Coder Social home page Coder Social logo

myxbackup's Introduction

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:

[email protected]
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)

myxbackup's People

Contributors

bbak avatar

Stargazers

 avatar Denis Safronenkov avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.