Difference between revisions of "AutoMysqlBackup"
Line 10: | Line 10: | ||
- Incremental database backups | - Incremental database backups | ||
− | + | ==Maintainer== | |
[[User:stephdl|Stephane de Labrusse]] | [[User:stephdl|Stephane de Labrusse]] | ||
mailto:stephdl@de-labrusse.fr | mailto:stephdl@de-labrusse.fr | ||
− | + | ==Installation== | |
For SME7 and Above. | For SME7 and Above. | ||
This contrib is not yet in the smecontribs repository, you have to download the rpm here and install it by the yum localinstall command. | This contrib is not yet in the smecontribs repository, you have to download the rpm here and install it by the yum localinstall command. | ||
Line 24: | Line 24: | ||
The src.rpm can be found in the folder [http://mirror.de-labrusse.fr/Sme-Server/Automysqlbackup/ following] | The src.rpm can be found in the folder [http://mirror.de-labrusse.fr/Sme-Server/Automysqlbackup/ following] | ||
− | + | ==smeserver Panel== | |
There is no panel for manage this contrib, you have to play with db configuration command but normally the options by default could be sufficient. | There is no panel for manage this contrib, you have to play with db configuration command but normally the options by default could be sufficient. | ||
− | + | ==DB command option== | |
− | + | ===Backup directory=== | |
It is the folder where you save you database backup '''(default is /root/backup/db)''' | It is the folder where you save you database backup '''(default is /root/backup/db)''' | ||
config setprop automysqlbackup Backupdir path/to/other/folder | config setprop automysqlbackup Backupdir path/to/other/folder | ||
Line 36: | Line 36: | ||
mkdir -p /path/to/other/folder | mkdir -p /path/to/other/folder | ||
− | + | ===Encryption=== | |
If you wish to encrypt your backups using openssl '''(no is default)''' | If you wish to encrypt your backups using openssl '''(no is default)''' | ||
config setprop automysqlbackup Encrypt yes | config setprop automysqlbackup Encrypt yes | ||
Line 44: | Line 44: | ||
{{Note box| This option may be useful when you want to save your databases outside of your server by sending them by mails. keep in mind to change the default password}} | {{Note box| This option may be useful when you want to save your databases outside of your server by sending them by mails. keep in mind to change the default password}} | ||
− | + | ===Decryption=== | |
To decrypt run : | To decrypt run : | ||
Line 54: | Line 54: | ||
-pass pass:01234567899876543210 | -pass pass:01234567899876543210 | ||
− | + | ===Mailcontent=== | |
you can choose your type of mail send to the admin '''(log by default)''' | you can choose your type of mail send to the admin '''(log by default)''' | ||
config setprop automysqlbackup Mailcontent option | config setprop automysqlbackup Mailcontent option | ||
Line 65: | Line 65: | ||
{{Tip box|Use the "'''files'''" option with the Mailcontent db to save your mysql databases in a mailbox outside of your server, moreover they are saved too in a local folder of your server (by default/root/backup/db)}} | {{Tip box|Use the "'''files'''" option with the Mailcontent db to save your mysql databases in a mailbox outside of your server, moreover they are saved too in a local folder of your server (by default/root/backup/db)}} | ||
− | + | ===Mailto=== | |
you can choose the mail account where you sent your mails '''(default is the mailbox admin of your server)'''. | you can choose the mail account where you sent your mails '''(default is the mailbox admin of your server)'''. | ||
config setprop automysqlbackup Mailto foo@foo.com | config setprop automysqlbackup Mailto foo@foo.com | ||
− | + | ===Sizemail=== | |
you can determine the size of mails sent '''(default is 8000 KB)'''. | you can determine the size of mails sent '''(default is 8000 KB)'''. | ||
Line 76: | Line 76: | ||
{{note box|keep in mind that a lot of smtp server reject mail bigger than 10 000 KB or 10MB}} | {{note box|keep in mind that a lot of smtp server reject mail bigger than 10 000 KB or 10MB}} | ||
− | + | ==RESTORING== | |
− | + | ===restoring a .sql file=== | |
In a root terminal | In a root terminal | ||
cd /root/backup/db/ and choose your backup | cd /root/backup/db/ and choose your backup | ||
Line 90: | Line 90: | ||
mysql --user=username --pass=password --host=dbserver database < /path/file.sql | mysql --user=username --pass=password --host=dbserver database < /path/file.sql | ||
− | + | ===restoring databases sent by mail attachment=== | |
The attachments have been split into multiple files, use this command line to combine them : | The attachments have been split into multiple files, use this command line to combine them : |
Revision as of 06:53, 29 May 2013
Automysqlbackup
AutoMySQLBackup associates with DB configuration will create Daily, Weekly and Monthly backups of your MySQL databases. 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". I'm fairly sure that you do not have to modify huge options except the mail where logs and files are sent. With this contribs you will save your mysql database in a simple way.
Other Features include: - Email notification of backups - Backup Compression and Encryption - Configurable backup rotation - Incremental database backups
Maintainer
Installation
For SME7 and Above. This contrib is not yet in the smecontribs repository, you have to download the rpm here and install it by the yum localinstall command.
wget http://mirror.de-labrusse.fr/Sme-Server/Automysqlbackup/smeserver-automysqlbackup-3.0.RC6-2.el5.sme.noarch.rpm yum localinstall smeserver-automysqlbackup-3.0.RC6-2.el5.sme.noarch.rpm
The src.rpm can be found in the folder following
smeserver Panel
There is no panel for manage this contrib, you have to play with db configuration command but normally the options by default could be sufficient.
DB command option
Backup directory
It is the folder where you save you database backup (default is /root/backup/db)
config setprop automysqlbackup Backupdir path/to/other/folder
you have to create manually 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 :
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
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 the mailbox admin of your server).
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
RESTORING
restoring a .sql file
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
restoring databases sent by mail attachment
The attachments have been split into multiple files, use this command line to combine them :
cat mail_attachment_2011-08-13_13h15m_* > mail_attachment_2011-08-13_13h15m.tar.bz2
and do this to extract the content
bunzip2 <mail_attachment_2011-08-13_13h15m.tar.bz2 | pax -rv
Bugs
for the moment there is no section for smeserver-automysqlbackup in bugzilla, so send me a mail to mailto:stephdl@de-labrusse.fr to speak of your issue.