Professional Web Applications Themes

tion - binary log auto removal after processing - MySQL

Can I get the master (or slaves) to automatically remove the binary logs once they are processed by all slaves? It says in the mysql manual : If you are using tion, you should not delete old binary log files until you are sure that no slave still needs to use them. For example, if your slaves never run more than three days behind, once a day you can execute mysqladmin flush-logs on the master and then remove any logs that are more than three days old. You can remove the files manually, but it is preferable to use PURGE ...

  1. #1

    Default tion - binary log auto removal after processing

    Can I get the master (or slaves) to automatically remove the binary
    logs once they are processed by all slaves?

    It says in the mysql manual :
    If you are using tion, you should not delete old binary log
    files until you are sure that no slave still needs to use them. For
    example, if your slaves never run more than three days behind, once a
    day you can execute mysqladmin flush-logs on the master and then
    remove any logs that are more than three days old. You can remove the
    files manually, but it is preferable to use PURGE MASTER LOGS, which
    also safely updates the binary log index file for you (and which can
    take a date argument as of MySQL 4.1). See Section 13.6.1.1, "PURGE
    MASTER LOGS Syntax".
    http://dev.mysql.com/doc/refman/4.1/en/binary-log.html

    This seems to suggest that you need to estimate an amount of time it
    will take for all slaves to be up to date, or have processed all the
    binary log files. If this is the case, how do you take into account
    something going wrong with the slave/s by not deleting the binary logs
    if this happens?

    It seems like a better idea to just remove the binary logs when the
    master has full evidence that all the slaves have correctly processed
    them (I/O thread retrieved them)... is there a way to do this?

    Thanks in advance!

    tech101@gmail.com Guest

  2. #2

    Default Re: tion - binary log auto removal after processing

    >Can I get the master (or slaves) to automatically remove the binary 

    How does the master know about "all slaves"? This includes the one
    you haven't finished building yet, and doesn't include the one that
    caught fire last week and hasn't logged in since but nobody informed
    MySQL that it was gone permanently (and there's no way to inform it)
    since you decided not to replace it.

    Oh, yes, just because a slave fetched a binary log file doesn't
    mean it processed it or won't need it again. For example, let's
    suppose that tion stopped because of some kind of error. It
    stops. You reset the starting point beyond the offending record,
    which I have observed deletes existing binary logs and when you
    start up tion, it starts re-fetching them.

    Also not ruled out is the possibility that a disk drive fails on a
    slave, you replace the drive and restore a day-old backup, then
    start up tion and it re-fetches a day's worth of logs.

    tion won't help you if someone executes a disastrous query
    and your tion setup efficiently tes the disaster
    (sometimes this is a query that should have had a WHERE clause but
    didn't) on all of your slaves. For that reason, keeping binary
    logs since your last backup is a good idea even if tion never
    gets that far behind.
     

    The master doesn't have that kind of evidence.

    Gordon Guest

  3. #3

    Default Re: tion - binary log auto removal after processing

    On Apr 13, 9:38 am, org (Gordon Burditt) wrote: 
    >
    > How does the master know about "all slaves"? This includes the one
    > you haven't finished building yet, and doesn't include the one that
    > caught fire last week and hasn't logged in since but nobody informed
    > MySQL that it was gone permanently (and there's no way to inform it)
    > since you decided not to replace it.
    >
    > Oh, yes, just because a slave fetched a binary log file doesn't
    > mean it processed it or won't need it again. For example, let's
    > suppose that tion stopped because of some kind of error. It
    > stops. You reset the starting point beyond the offending record,
    > which I have observed deletes existing binary logs and when you
    > start up tion, it starts re-fetching them.
    >
    > Also not ruled out is the possibility that a disk drive fails on a
    > slave, you replace the drive and restore a day-old backup, then
    > start up tion and it re-fetches a day's worth of logs.
    >
    > tion won't help you if someone executes a disastrous query
    > and your tion setup efficiently tes the disaster
    > (sometimes this is a query that should have had a WHERE clause but
    > didn't) on all of your slaves. For that reason, keeping binary
    > logs since your last backup is a good idea even if tion never
    > gets that far behind.
    >
    >



    >
    > The master doesn't have that kind of evidence.[/ref]

    Ok, that all makes sense, what I wanted to remove them before the /var/
    lib/mysql directory filled up and choked mysql. I guess this is the
    sort of thing should be part of a backup procedure.

    Thanks

    tech101@gmail.com Guest

Similar Threads

  1. How to auto-reboot a SUN, then auto-login, then auto-start a
    By Roboo in forum Linux / Unix Administration
    Replies: 2
    Last Post: January 17th, 12:58 PM
  2. Forced tion in File tion Services
    By James in forum Windows Server
    Replies: 0
    Last Post: July 16th, 03:45 PM
  3. Replies: 5
    Last Post: June 26th, 12:31 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139