This shows you the differences between two versions of the page.
nethserver-automysqlbackup [2016/09/24 19:05] stephdl |
nethserver-automysqlbackup [2019/06/05 19:48] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==Automysqlbackup== | ||
- | [http:// | ||
- | With this contribs you save your mysql databases in a simple way. | ||
- | |||
- | Other Features include: | ||
- | *Email notification of backups | ||
- | *Databases split and sent by mails | ||
- | *Backup Compression and Encryption | ||
- | *Configurable backup rotation (no db command yet, you have to do it manualy) | ||
- | *Incremental database backups (no db command yet, you have to do it manualy) | ||
- | |||
- | ==Installation== | ||
- | |||
- | First you need to install my repository, [[nethserver|see how to do it]] | ||
- | |||
- | then you can install my module (not yet available) | ||
- | yum install nethserver-automysqlbackup --enablerepo=stephdl | ||
- | | ||
- | == 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. | ||
- | |||
- | ==How to launch the backup== | ||
- | You can launch manually the database backup by a command line with automysqlbackup in a root terminal. | ||
- | automysqlbackup | ||
- | otherwise every night, a cron job start à 4h00 AM to save your databases. | ||
- | ==DB command option== | ||
- | If you want to see the db configuration of automysqlbackup. | ||
- | config show automysqlbackup | ||
- | ===Backup directory=== | ||
- | It is the folder where you save you database backup ''' | ||
- | <WRAP center round tip 60%> | ||
- | keep in mind that the /root folder is saved with the backup of your server-manager | ||
- | </ | ||
- | |||
- | #ls / | ||
- | daily fullschema | ||
- | |||
- | If you want to save in another place, you have to do the command below. | ||
- | |||
- | config setprop automysqlbackup Backupdir / | ||
- | you have to create manually your new backup directory | ||
- | mkdir -p / | ||
- | |||
- | ===Backup a local directory=== | ||
- | the possibility is given to you to save a local directory by automysqlbackup. I suppose that you can not use it for large folder but for a web site with its database it could be useful. not activated by default | ||
- | config setprop automysqlbackup Backup_local_files / | ||
- | |||
- | ===Encryption=== | ||
- | If you wish to encrypt your backups using openssl ''' | ||
- | config setprop automysqlbackup Encrypt yes | ||
- | you need to set a password ''' | ||
- | config setprop automysqlbackup Dbencrypt_password your-password | ||
- | |||
- | <WRAP center round important 60%> | ||
- | 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 : | ||
- | |||
- | openssl enc -aes-256-cbc -d -in encrypted_file_name(ex: | ||
- | |||
- | 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: | ||
- | |||
- | ===Mailcontent=== | ||
- | <WRAP center round important 60%> | ||
- | You need to install the rpm nethserver-mail-server and set a password to the ' | ||
- | </ | ||
- | |||
- | you can choose your type of mail send to the admin ''' | ||
- | 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. | ||
- | |||
- | <WRAP center round tip 60%> | ||
- | Use the "''' | ||
- | </ | ||
- | |||
- | ===Mailto=== | ||
- | |||
- | <WRAP center round important 60%> | ||
- | You need to install the rpm nethserver-mail-server and set a password to the ' | ||
- | </ | ||
- | |||
- | you can choose the mail account where you sent your mails ''' | ||
- | |||
- | config setprop automysqlbackup Mailto foo@foo.com | ||
- | |||
- | ===Sizemail=== | ||
- | |||
- | you can determine the size of mails sent ''' | ||
- | config setprop automysqlbackup Sizemail 8000 | ||
- | |||
- | <WRAP center round tip 60%> | ||
- | keep in mind that a lot of smtp server reject mail bigger than 10 000 KB or 10MB | ||
- | </ | ||
- | |||
- | |||
- | ==Manual Settings== | ||
- | There are many options you can modify in automysqlbackup, | ||
- | |||
- | cp / | ||
- | nano / | ||
- | |||
- | ==RESTORING== | ||
- | ===restoring a .sql file=== | ||
- | In a root terminal | ||
- | cd / | ||
- | 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 < / | ||
- | |||
- | 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 < / | ||
- | |||
- | ===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 < | ||
- | |||
- | ==Known Issues== | ||
- | * Warning: Skipping the data of table mysql.event. Specify the --events option explicitly. SOLVED in [[bugzilla: | ||
- | see http:// | ||
- | see that discussion http:// | ||
- | some solutions : | ||
- | if we want to backup databases | ||
- | | ||
- | or if we don't want to backup them | ||
- | | ||
- | |||
- | ==Bugs== | ||
- | |||
- | Please raise Issues on [[https:// | ||
- | |||
- | {{tag> |