Forum Moderators: phranque

Message Too Old, No Replies

Trimming mysql binary files.

Is this wise?

         

mack

8:01 pm on Jun 20, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Hi all.

I was checking up on mysql database sizes, my current db is about 28 gig, but when i browse to /var/lib/mysql the disk space used in this directory is close on 55 gig.

I noticed that there are a lot of files in the following format....
computername-bin 001 through to computername-bin 061

If my understanding is correct these binnaries are used for replication purposes across more servers, I have since moved all the files into a different directory and have seen no ill efects, is it safe for me to dump them, or are they used for some other purpose?

Mack.

mack

2:42 pm on Jun 21, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Quick bump. ;-)

Anyone know if the binnary files are required, or can I delete them?

Mack.

txbakers

3:15 pm on Jun 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As far as I know, there are three files associated with each table in the "data" folder. I don't know of any other files that are needed.

But I'm not a certified mySQL expert, so if you delete them, don't blame me.

coopster

5:02 pm on Jun 22, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I believe you are correct in assuming they are replication files. Do you have replication implemented? There are probably two other files in that directory as well...

Once a slave is replicating, you will find in its data directory one file named

`master.info'
and another named
`relay-log.info'
. The slave uses these two files to keep track of how much of the master's binary log it has processed. Do not remove or edit these files, unless you really know what you are doing and understand the implications. Even in that case, it is preferred that you use the
CHANGE MASTER TO
statement.

References:
Replication Relay and Status Files [dev.mysql.com]
How to Set Up Replication [dev.mysql.com]

...and here is the info you are more than likely looking at...


If you are using replication, you should not delete old binary log files until you are sure that no slave still needs to use them. One way to do this is to do
mysqladmin flush-logs
once a day and then remove any logs that are more than three days old. You can remove them manually, or preferably using
PURGE MASTER LOGS
(see section 14.6.1 SQL Statements for Controlling Master Servers), which will also safely update the binary log index file for you (and which can take a date argument since MySQL 4.1)

Resource:
The Binary Log [dev.mysql.com]