> -----Original Message----- > From: Baron Schwartz [mailto:[EMAIL PROTECTED] > Sent: Wednesday, May 02, 2007 7:55 AM > To: Ofer Inbar > Cc: mysql@lists.mysql.com > Subject: Re: expire_logs_days > > Hi, > > Ofer Inbar wrote: > > There's a system variable called expire_logs_days that lets you set a > > number of days to keep binary logs, and automatically delete logs > > older than that. I've heard rumors that using this feature is > > problematic. I notice that in the MySQL documentation about binary > > logging, it tells you to use "purge master logs" to delete old logs, > > and does not mention the expire_logs_days variable as another option. > > Is there a reason for this omission, or is it safe to use? > > -- Cos > > > > Actually, the manual does mention the variable, but it doesn't work for us. > We run a > nightly cron job that just runs > > /usr/bin/mysql -e "PURGE MASTER LOGS BEFORE DATE_SUB(CURRENT_DATE, > INTERVAL 9 DAY)" >
We do the same thing, based on the "rumors" I read at the time I set it up. (Where "rumors" means that googling for expire_logs_days reveals many with problems and not much good news.) I would recommend you figure out the value for "n day" above based on keeping your binlog partition about 50% full. This will allow you to go back more days in the backup scheme if something went wrong with your backups. It also allows more room for large import operations which would otherwise fill the /binlog partition. 21 days is about right for our usage model with a 32G binlog partition, but YMMV. # df -h /binlogs /data Filesystem Size Used Avail Use% Mounted on /dev/sdb1 32G 15G 16G 48% /binlogs /dev/sdb2 237G 50G 176G 22% /data # cat /etc/cron.mysql/20-purgemasterlogs #!/bin/sh /usr/bin/mysql --defaults-file=/root/.my.cnf -e 'show master logs; purge master logs before date_sub(now(), interval 21 day); show master logs;' >/var/log/20-purgemasterlogs.log 2>&1 Tim > Baron > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]