2

Today, I checked the /var/lib/mysql/ directory of a server in a master-master replication setup and noticed there were about 3,600 slave-relay.00xxxx files in there (where "xxxx" is an incrementing integer).

They appear to be binary log files and don't take up much space (only about 42K), but are they an indication that something is wrong?

They range in date from August until today with about 25 per day.

Thanks for any help.

Andrew Ensley
  • 932
  • 2
  • 17
  • 30

1 Answers1

1

You can read this from dev.mysql.

Mysqld appends a numeric extension to the binary log basename to generate binary log file names.
The number increases each time the server creates a new log file, thus creating an ordered series of files.
The server creates a new file in the series each time it starts or flushes the logs. 
The server also creates a new binary log file automatically after the current log's size reaches max_binlog_size.
A binary log file may become larger than max_binlog_size if you are using large transactions because
a transaction is written to the file in one piece, never split between files.

In summary, you can relate the number of log files to the number of transactions and queries you are executing. Also, the maximum size of log file can affect how many files you will have.

If you know your database is always busy executing queries (doing insert/update/delete), this should be normal.

Khaled
  • 36,533
  • 8
  • 72
  • 99
  • That information does help, but I'm still confused. This database server sees over 17k inserts and 500k selects per day. This amounts to ~4.5MB of new data per day. It seems like if the log files related to the number of queries, I would have a lot more than 3600 files and 42KB. Also, why does it keep them for so long? The oldest files are over 3 months old! – Andrew Ensley Jan 05 '11 at 18:40