List:General Discussion« Previous MessageNext Message »
From:Baron Schwartz Date:April 26 2007 4:52pm
Subject:Re: Bin logs and mysql 4
View as plain text  
Hi Scott,

Scott Haneda wrote:
>> In the short term, see the manual page for PURGE MASTER LOGS.  In the
>> long term, write a cron job.
>>
>> innotop (http://sourceforge.net/projects/innotop) also has a new
>> feature, unreleased because I just wrote it a few hours ago, which will
>> help you figure out which binlogs can be purged safely with a single
>> keystroke :-)
> 
> I don't quite get this, if SHOW SLAVE STATUS shows empty result set, and I
> am just running one server, not a master + slave setup at all, its really
> rather simple.
> 
> So, how would I ever know what logs I can safely delete or purge?
> 
> Do I really need to use mysql to purge them or can I just `rm` them?
> 
> I guess I could push this to cron?
> PURGE MASTER LOGS BEFORE DATE_SUB( NOW( ), INTERVAL 31 DAY);
> 
> My question is, what are these logs really good for, I assume restoration,
> and from what I read, but how do I know how far back I should keep?
> 
> thanks

Yes -- sorry for being so  general.  You can use the binlogs for a) 
replication b) replaying changes since your last backup so you get 
point-in-time recovery.  If you have no replication slaves, just delete 
everything older than your latest backup.  You  can just use 'rm'.  If 
you use PURGE MASTER LOGS BEFORE, it's a bit easier than cron because 
you can do it across all platforms easily.  On UNIX of course, you'd use 
something like

find /var/lib/mysql/data -name "*.bin" -mtime +7 -exec rm {} \

(My find syntax is guaranteed to be wrong there... don't run that as I 
typed it).

But if you do it via SQL, you don't have to mess with this.

Baron
Thread
Bin logs and mysql 4Scott Haneda26 Apr
  • Re: Bin logs and mysql 4Baron Schwartz26 Apr
    • Re: Bin logs and mysql 4Scott Haneda26 Apr
      • Re: Bin logs and mysql 4Baron Schwartz26 Apr
        • Re: Bin logs and mysql 4Scott Haneda26 Apr
          • an't connect to local MySQL -- Help me!Charles Brown26 Apr
          • Re: Bin logs and mysql 4Baron Schwartz26 Apr
      • Re: Bin logs and mysql 4Scott Tanner26 Apr
Re: Bin logs and mysql 4dpgirago27 Apr
  • Re: Bin logs and mysql 4Scott Tanner30 Apr