473,698 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Replication - 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 replication, 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!

Apr 12 '07 #1
2 7232
>Can I get the master (or slaves) to automatically remove the binary
>logs once they are processed by all slaves?
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 replication 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 replication, 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 replication and it re-fetches a day's worth of logs.

Replication won't help you if someone executes a disastrous query
and your replication setup efficiently replicates 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 replication never
gets that far behind.
>It says in the mysql manual :
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. 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?
The master doesn't have that kind of evidence.

Apr 12 '07 #2
On Apr 13, 9:38 am, gordonb.bm...@b urditt.org (Gordon Burditt) wrote:
Can I get the master (or slaves) to automatically remove the binary
logs once they are processed by all slaves?

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 replication 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 replication, 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 replication and it re-fetches a day's worth of logs.

Replication won't help you if someone executes a disastrous query
and your replication setup efficiently replicates 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 replication never
gets that far behind.
It says in the mysql manual :
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. 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?

The master doesn't have that kind of evidence.
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

Apr 13 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3263
by: I.P. | last post by:
Hi, it's my story. I have two 4.0.14 mysql server on one machine with win XP Professional polish version. First acts as master: on port 3300 Second acts as slave: on port 3301 below my configuration:
0
2142
by: I.P. | last post by:
No one has replied to my post. ----- Original Message ----- From: "I.P." <jancio_wodnik@wp.pl> To: <mysql@lists.mysql.com> Sent: Monday, August 18, 2003 1:01 PM Subject: mysql 4.0.14 + replication + windows XP PROF Hi, it's my story.
0
583
by: I.P. | last post by:
------=_NextPart_000_03FF_01C368A4.75720DC0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable Hi, it's my story. I have two 4.0.14 mysql server on one machine with win XP Professional polish version.
0
1996
by: Ilja Booij | last post by:
Hi all, I have set up master/slave replication between 2 servers (1 master, 1 slave). However, when I change a table on the master (e.g. by inserting a row), the same table on the slave is not updated. The strange thing is that if I enter SHOW SLAVE STATUS on the client, it gives me the same offset in the binary log on the master as the master gives when issuing SHOW MASTER STATUS (both entered after the update). I'm trying to...
1
1153
by: steve | last post by:
I am thinking about implementing replication. Basic question is what kind of delay there would be to have the data replicated. Not a massive table, and all on the same net. Furthere, can you specify priority for replication? -- Posted using the http://www.dbforumz.com interface, at author's request Articles individually checked for conformance to usenet standards Topic URL:...
6
2346
by: RdR | last post by:
Hi, Has anyone encountered infinite looping in Q Replication? This happens when I have a source DB2 table A going to a target DB2 table B, it also happens that the samne target table B is replicated back to source table A (true bi-directional replication scenario). Once I start replication on a master to master scenario the changes in A gets replicated to B but that change gets replicated back to A and so on creating an infinite loop. Is...
1
1352
by: Danke | last post by:
I have Access 97 and the tabels are linked to an SQL-server. Is is possible to make an replication (a copy) and distribute this to the users and not make it possible for the users to do any changes on forms, reports etc. I cant make an .mde when I use it this way.
4
9016
by: Tarique Jawed | last post by:
Alright I needed some help regarding a removal of a binary search tree. Yes its for a class, and yes I have tried working on it on my own, so no patronizing please. I have most of the code working, even the removal, I just don't know how to keep track of the parent, so that I can set its child to the child of the node to be removed. IE - if I had C / \ B D
3
1392
by: subaruwrx88011 | last post by:
Hello, I am very new to MySQL and just got done reading the replication chapter in my reference manual. I kinda understand but I still don't know if my scenario is going to work out. Here is my scenario. I have 2 servers, A and B. A is the primary server and master in mysql. B is the redundant server and the slave in mysql. A is replicating to B. Now A fails and B becomes the primary server (still slave in mysql?). A finally comes...
0
8674
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8895
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7728
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4369
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2330
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.