The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

mysql one-bin files filling hard drive

Discussion in 'General Discussion' started by surfalot, Jul 25, 2007.

  1. surfalot

    surfalot Member

    Joined:
    Nov 2, 2004
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    This server's hard drive was filling to the max. Looked at the Horde issues, not having them here. What I found was one-bin.001, one-bin.002, etc. in /var/lib/mysql/. Doesn't seem to be any other posts here about the files.

    Looks like they are accumulating at 2-3 per month and are now 1G in size each.

    I now have 53G of these files from over the last few years. Can they be removed? Should I be saving the last one? and, what are they, why are they there?

    Any answers would be appreciated!
     
  2. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    I *think* those are the binary log files, necessary for replication only. If you aren't using replication, try moving them to a different directory and restarting mysql. If nothing breaks (after a bit of testing) you can likely delete them.
     
  3. surfalot

    surfalot Member

    Joined:
    Nov 2, 2004
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    yes, indeed it is.

    for those with MySQL v4.1 or better, you can use the expire_logs_days setting in the mysqld section or your my.cnf, or try the cron offered in the comments of MySQL dev site for PURGE MASTER LOGS Syntax

    for those with versions below that, with no slave servers, and no need use the logs for an incremental restore, you can turn off the binary logging by removing log-bin or log-bin=some-log-file setting from your my.cnf. You will save about 1% in performance by not using the binary logs.

    for all others, enter in your SSH session:

    mysql
    PURGE MASTER LOGS TO 'xxxxx-bin.010';
    quit


    replace 'xxxxx-bin.010' with the name of the file you wish to cut off the logs at. I have looked and looked, but can't find an automatic way to remove these for versions below MySQL v4.1.0. Each method I found used commands only available after v4.1.0.

    Nobody recommends just deleting them since an index of those files is kept and that can confuse poor old mysqld (as well as editing the index while its running). The purge commands will handle resetting the index. :)

    All other solutions require restarting mysqld and some manual rotation which is not desirable. :eek:

    hope this helps someone.
     
Loading...

Share This Page