Comments on: Fighting MySQL Replication Lag https://www.percona.com/blog/fighting-mysql-replication-lag/ Tue, 02 Jun 2015 09:27:23 +0000 hourly 1 https://wordpress.org/?v=6.5.2 By: Gopal https://www.percona.com/blog/fighting-mysql-replication-lag/#comment-10834559 Tue, 02 Jun 2015 09:27:23 +0000 https://www.percona.com/blog/?p=507#comment-10834559 Hi Adarsh,

1. Yes ‘SQL_LOG_BIN’ will work for any number of Slaves, as this variables make sure that the event is not written to Binary Log.

2. For getting the list of Slaves, you can also run following statement in Master:

show slave hosts;

Best Regards
Gopal

]]>
By: Adarsh https://www.percona.com/blog/fighting-mysql-replication-lag/#comment-8007379 Fri, 25 Jul 2014 07:25:37 +0000 https://www.percona.com/blog/?p=507#comment-8007379 Thanks Peter for such detailed explaination. I have two doubts :

1. You mentioned to disable bin logging before any DML that requires significant time. Can we apply the same if we have one
Master – 10 Slaves ? If I want to change engine from Innodb MyISAM or vice versa , Would you suggest the same
way or pt-online-schema-change will be better ?
2. Is there any way i can get to know how many slaves are in Master Slave replication. Will this work :

select distinct host from information_schema.processlist WHERE user = ‘slave_user’
If all slaves are not connected to master at the time when i fired this command.

Looking forward to your reply.

Thanks

]]>
By: Abhijit Buchake https://www.percona.com/blog/fighting-mysql-replication-lag/#comment-2122493 Tue, 30 Jul 2013 13:10:50 +0000 https://www.percona.com/blog/?p=507#comment-2122493 I observed a slave unable to catch replication for weeks (in fact lag getting increased continuously) although simple INSERT DELAYED INTO queries run on master. Both the servers having equal capacity.

The problem was that master was able to handle about 4k queries per second while due to single-thread nature of replication, slave was able to read and execute only around 600 queries per second (no network issue as MASTER_LOG_FILE in slave status almost remains same as that on master being written currently and there are plenty of pending relay logs).

Can anybody suggest a workaround apart from hardware upgrade?

]]>
By: Tixik https://www.percona.com/blog/fighting-mysql-replication-lag/#comment-1084250 Mon, 29 Oct 2012 16:45:14 +0000 https://www.percona.com/blog/?p=507#comment-1084250 Great article. We had exactly the same issues with multiple small insert queries in multiple threads on MASTER, where slave (almost sleeping) is not able to keep the speed .( Is the any possibility to remove simple select transactions, where not UPDATE is done ?

]]>
By: Jonathan Valerio https://www.percona.com/blog/fighting-mysql-replication-lag/#comment-877302 Wed, 18 Jan 2012 06:41:38 +0000 https://www.percona.com/blog/?p=507#comment-877302 @memfill,

I also have experienced that before and I have wasted my time looking for the replication issue I until I got an idea of check server clock.

]]>
By: Memfill https://www.percona.com/blog/fighting-mysql-replication-lag/#comment-783772 Mon, 22 Nov 2010 23:13:24 +0000 https://www.percona.com/blog/?p=507#comment-783772 Dont forget that replication lag can also be simply fake, make sure you clock is in sync
More details here: http://www.memfill.com/tech/mysql-replication-lag/

]]>
By: Erik Ljungstrom https://www.percona.com/blog/fighting-mysql-replication-lag/#comment-357534 Wed, 24 Sep 2008 07:16:22 +0000 https://www.percona.com/blog/?p=507#comment-357534 Chad,

SQL_LOG_BIN which Peter mentioned is a session variable. Any statement you run in that thread will not end up in the binary log, thus not be replicated. So rather than skipping a transaction on all the slaves, you simply don’t log it on the master.

In terms of promoting slaves, it’s not entirely necessary to get them to the same binlog position. If you as per your previous comment have the luxury of being able to ensure that no updates hit the DBs, you can simply do it with a series of CHANGE MASTER statements whilst you are certain that the DBs have the same data (ie. the writes doesn’t go through and all slaves are caught up).

]]>
By: chad walker https://www.percona.com/blog/fighting-mysql-replication-lag/#comment-357516 Wed, 24 Sep 2008 03:37:49 +0000 https://www.percona.com/blog/?p=507#comment-357516 Yeah I never thought about trying to disable replication for that one command. It would be nice if there was a comment way to do it, like:
ALTER TABLE foo /* NO_BIN_LOG */ ADD INDEX foo_a_b (a, b);

I’ve seen you talk about promoting a slave to be the new master before, but in my eyes that has always seemed like a huge pain that is full of potential pitfalls. We run with one master and 4 slaves, the master does about 20k questions a minute and the slaves each do about 11k. How hard is it to synchronize them to the same master bin log position? FWIW, our site wasn’t down for the above index update, we have an intermediate proxy layer that acts as a write-through cache and queued the writes until the master could handle them.

]]>
By: Peter Zaitsev https://www.percona.com/blog/fighting-mysql-replication-lag/#comment-357480 Tue, 23 Sep 2008 22:51:13 +0000 https://www.percona.com/blog/?p=507#comment-357480 Chad,

You’re completely right. Even though MySQL Replication is great in its ability to replicate DDL too it is often not practical because of replication lag it causes and other reason.

It often makes sense to use SQL_LOG_BIN=0 to run query only on master (or start from the slave). Plus this often allows you to do massive DDL without taking sight down – you just run it on the slave, promote it to the master and run on ex-master.

]]>
By: chad walker https://www.percona.com/blog/fighting-mysql-replication-lag/#comment-357472 Tue, 23 Sep 2008 21:14:42 +0000 https://www.percona.com/blog/?p=507#comment-357472 Recently we had to add an index to a table with 12M rows. It took a couple minutes to run in testing, so we knew we couldn’t just run it on the master and let it trickle through replication. What we did was take a slave at a time out of rotation, add the index, then add the slave back into rotation. Once all the slaves were done we added the index on the master. When the master was done and replicated the index, we went to each slave and skipped that transaction.

]]>