• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5856
  • Last Modified:

Mysql 'bin' logs?

This should be a fairly simple question...

I have a huge amount of 'hostname-bin.001' to 'hostname-bin.NNN' style logs in my mysql directory.

My question is,

A: What are these logs good for?
B: If I'm making regular (hourly) backups of my databases anyway via another system, are these useless?
C: Is there a way to turn off these logs?

Many thanks,
-Umbrae
0
umbrae
Asked:
umbrae
  • 2
1 Solution
 
lokusCommented:
Extracted from http://dev.mysql.com/doc/mysql/en/Backup.html
Stop mysqld if it's running, then start it with the --log-bin[=file_name] option. See section 5.9.4 The Binary Log. The binary log files provide you with the information you need to replicate changes to the database that are made subsequent to the point at which you executed mysqldump.

Even if you are doing an hourly backup, the binary log is still important. Every time you do a backup, you should take note of the point of the binary log. Easier to do a FLUSH LOGS and take note of the next binary log filename.

In a crash, after you restore from your backup, you can replay the binary logs after the backup to obtain an up-to-date (till the state before the crash). You will need a backup and the binary logs to do a restore without losing too much data.
If you have the binary logs in a separate disk from your database tables, maybe you do not need to backup as frequent as hourly, maybe daily will do.

Old binary logs of course can be deleted when no longer needed. Just keep the binary log since the previous 2 or 3 backups will be sufficient. Or, you can archive them together with your backup if you want.

0
 
UmeshCommented:
Hi,

[Taken from NET & might be identical to above comment..]

The binary log is primarily there to let you restore data. Say you backup
every night at 04:00 and your database crashes at 15:00 you can restore from
your backup but what about all those changes in the 11 hours after the
backup was made?


Instead you can use mysqlbinlog to run all the changes made in those 11
hours and get your data back to pretty much exactly where it was before the
crash.


According to the manual, the performance hit is about 1% - that's peanuts in
exchange for the ability to recover your data.


The other function of the binary log is to store statements that will be
replicated on slave servers. That might not be relevant to you at the
moment, but will perhaps be something you need later?


If you really want to disable it, read the manual page at:


http://dev.mysql.com/doc/mysql/en/Binary_log.html 


0
 
UmeshCommented:
it was late.. sorry..
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now