handling mysql binlog data

Zbigniew Szalbot z.szalbot at lc-words.com
Fri May 2 15:58:11 UTC 2008


Chris Pratt pisze:

> On May 2, 2008, at 5:27 AM, Zbigniew Szalbot wrote:
>> Hello,
>> Following a recent thread I would like to ask if it is safe to  
>> remove old binlog data. From the below I understand that the  
>> current binlog is mysql-bin.000007 and the previous ones (from  
>> 000001-000006) are not written to any more. I just need  
>> confirmation before I take any action. By asking whether it is  
>> safe, I only mean if deleting them will not affect mysql operation.  
>> I do backups of mysql data anyway.
>> -rw-rw----  1 mysql  mysql    61956466 Apr 16 08:44 mysql-bin.000001
>> -rw-rw----  1 mysql  mysql   697756219 Apr 17 14:26 mysql-bin.000002
>> -rw-rw----  1 mysql  mysql        1056 Apr 17 14:29 mysql-bin.000003
>> -rw-rw----  1 mysql  mysql  1073745860 Apr 24 05:49 mysql-bin.000004
>> -rw-rw----  1 mysql  mysql   620489997 Apr 27 10:48 mysql-bin.000005
>> -rw-rw----  1 mysql  mysql   229357379 Apr 28 15:55 mysql-bin.000006
>> -rw-rw----  1 mysql  mysql   869964294 May  2 14:15 mysql-bin.000007
>> Do I understand correctly that removing mysql-bin.000007 would  
>> result in mysql not writing any data to mysql-bin file until the  
>> server gets restarted?
> I recently removed all logs prior to the one shown as current
> without any problems. I would not think you would want to
> remove the one currently in use or problems would result.
> The procedure for this is here:
> http://dev.mysql.com/doc/refman/5.1/en/purge-master-logs.html
> for 5.1 and here:
> http://dev.mysql.com/doc/refman/5.0/en/purge-master-logs.html
> for 5.0

Thanks a lot! It did help me get rid of a few files in a safe way. I 
only wonder now how to set up a cron job to do it on a permanent basis?

1/ I would probably be better off setting this mysql query (URGE {MASTER 
| BINARY} LOGS BEFORE 'date') in a separate file an run it from cron?

2/ Even if I do that, I would still have to change the 'date' value each 
month... hmm... as non-programmer I will probably do best to simply 
enter a task in a calendar to run this manually... each month :)

Thank you anyway - this was very helpful and I instantly saved a lot of 
space on a shrinking /var partition!

Zbigniew Szalbot
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2864 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20080502/53ca14ca/smime.bin

More information about the freebsd-questions mailing list