[ubuntu-za] MySQL backup

Bruce Pieterse dev at otq.za.net
Mon Oct 12 16:13:38 UTC 2015


On 12/10/2015 12:12, Charl Wentzel wrote:
> Hi Guys
>
> Sorry for asking for this on the list, but I'm in Zambia again and only
> only have access to email (no Internet access).  Otherwise I would have
> searched for a solution myself.
>
> I have an Ubuntu 14.04 server running a MySQL server for which I want to
> do daily backups.  The server is only busy from 6am to about 10pm.  So
> I'm considering a simple cron job that runs mysqldump  at midnight.  But
> I have a few questions:
>
> a. Is this a good way to do it?  Or is there something beter?
>
> b. If I use cron:
>     b.1 how do I generate unique file names for the backups?
>            e.g. [db_name][date]
>     b.2 how do I delete old versions so I don't fill up the hard drive?
>            e.g. keeping  only backups for two weeks, and once a month
> thereafter.
>
> Thanks
> Charl
>

Hi Charl,

I use AutoMySQLBackup[0] for this task. You can set this up to do daily, 
weekly and/or monthly backups. It also does rotational clean ups which 
is defined in the configuration file.

For b.2 your configuration options will be:
CONFIG_rotation_daily=7 (keep 7 days worth of backups)
CONFIG_rotation_weekly=4 (replace last 7 days with a weekly backup)
CONFIG_rotation_monthly=1 (replace last 4 weeks with a monthly backup)

If you are running this with a backup application like duplicity, daily 
backups should be sufficient as you can always go back in time.

Hope that helps.

[0]: http://sourceforge.net/projects/automysqlbackup/

Cheers
-- 
All the best,

Bruce



More information about the ubuntu-za mailing list