AutoMysqlBackup

From SME Server
Revision as of 01:24, 26 April 2013 by Stephdl (talk | contribs)
Jump to navigationJump to search
Warning.png Work in Progress:
This page is a Work in Progress. The contents off this page may be in flux, please have a look at this page history the to see list of changes.


Automysqlbackup

AutoMySQLBackup with a DB configuration will create Daily, Weekly and Monthly backups of one or more of your MySQL databases from one or more of your MySQL servers. At least there is no panel in the server-manager but the configuration is quite simple with few commands listed above, handle by "config setprop automysqlbackup".


Other Features include: - Email notification of backups - Backup Compression and Encryption - Configurable backup rotation - Incremental database backups

Maintainer

Stephane de Labrusse

mailto:stephdl@de-labrusse.fr

Installation

for the instant you have to download the rpm here and install it by the yum localinstall command

wget http
yum localinstall 

DB command option

Backup directory

it is the folder where you will save you database backup (default is /root/backup/db)

config setprop automysqlbackup Backupdir "path/to/other/folder"

you have to create your new backup directory

mkdir -p /path/to/other/folder

Encryption

If you wish to encrypt your backups using openssl (no is default)

config setprop automysqlbackup Encrypt "yes"

you need to set a password (default is 01234567899876543210)

config setprop automysqlbackup Dbencrypt_password "your-password"
Decryption

To decrypt run (replace gz with bz2 if using bzip2):

openssl enc -aes-256-cbc -d -in encrypted_file_name(ex: *.enc.gz) -out outputfilename.gz -pass pass:your-password

example :

openssl enc -aes-256-cbc -d -in daily_horde_2013-04-26_01h41m_Friday.sql.gz.enc -out daily_horde_2013-04-26_01h41m_Friday.sql.gz -pass pass:01234567899876543210

Mailcontent

you can choose your type of mail send to the admin (log by default)

config setprop automysqlbackup Mailcontent "option"
  • log : send only log file (default)
  • files : send log file and sql files as attachments
  • stdout : will simply output the log to the screen if run manually.
  • quiet : Only send logs if an error occurs to the MAILADDR.

Mailto

you can choose the mail account where you sent your mails (default is admin).

config setprop automysqlbackup Mailto "foo@foo.com"

Sizemail

you can determine the size of mails sent (default is 8000 KB).

config setprop automysqlbackup Sizemail "8000"
Important.png Note:
keep in mind that a lot of smtp server reject mail bigger than 10 000 KB or 10MB


RESTORING

In a root terminal

cd /root/backup/db/ and choose your backup
gunzip file-name.sql.gz

Next you will need to use the mysql client to restore the DB from the sql file.

mysql database < /path/file.sql

NOTE: Make sure you use < and not > in the above command because you are piping the file.sql to mysql and not the other way around

If you want to play with another user or a remote mysql server you can use this command line

mysql --user=username --pass=password --host=dbserver database < /path/file.sql