Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account

Replication and EC2 gotcha

Tonight a client restarted some instances on EC2 and they got different IPs.

This broke replication because the slaves were trying to connect to the masters using IPs that weren't existing any more.

To solve the task is easy: just CHANGE MASTER TO using the new IP (or the hostname).

Although there is a small gotcha, that probably you already know but it can be easy to forget.

From http://dev.mysql.com/doc/refman/5.1/en/change-master-to.html :

If you specify the MASTER_HOST or MASTER_PORT option, the slave assumes that the master server is different from before (even if the option value is the same as its current value.) In this case, the old values for the master binary log file name and position are considered no longer applicable, so if you do not specify MASTER_LOG_FILEand MASTER_LOG_POS in the statement, MASTER_LOG_FILE='' and MASTER_LOG_POS=4 are silently appended to it.

That is: CHANGE MASTER TO MASTER_HOST='new_ip_address' is NOT enough: actually, it will break replication because it will start replication from the first binlog.

You need to specify all the parameters required to setup replication, like master_user, master_password, master_log_file and master_log_pos .

To get replication position (where replication stopped) you can either check the output of SHOW SLAVE STATUS looking for Master_Log_File and Read_Master_Log_Pos, or the error log.

A side note for the curious ones: there was no downtime, as the master/slave are really a master/master pair. The "slave" failing to connect to the "master" was the write master trying to connect to the stand-by master.


PlanetMySQL Voting: Vote UP / Vote DOWN
Source Article
Comments
0
Be the first to comment

Join with account you already have


Sign in with Twitter account
Sign in with Facebook account
Sign in with Google Friend Connect
avatar
Tags: master host, slave status, refman, master password, ec2, master server, master slave, option value, current value, gotcha, replication, downtime, ip address, hostn
SQL gotcha
Feb 14, 2011
This is a multi-part message in MIME format.As you all know, when you specify an alias for a table or column name, the keyword "AS" is usually optional. I personally like to always include the "AS" keyword, if for no other reason than…

Long queue ID support gotcha
Mar 12, 2011
Today I was testing an option for long Postfix queue IDs (queue file names) that won't be reused for about 30+ years. The idea is to prepend the 30 least significant bits of the time in seconds to the queue ID. For the long queue IDs I chose an…

Aggregate functions and the Perl API - a numeric gotcha
Aug 11, 2010
This problem make me crazy! The previous post is at http://groups.google.com/group/mongodb-user/browse_thread/thread/9033e ecac5145347/64231109a1792f58 I paste the code again: $db->run_command({ group => Tie::IxHash->new( ns =>…

Re: Issue 207 in redis: Replication of MSET with binary values breaks replication
Aug 27, 2010
Updates: Status: Verified Comment #4 on issue 207 by antirez: Replication of MSET with binary values breaks replication http://code.google.com/p/redis/issues/detail?id=207 (No comment was entered for this change.)

Closed: (DERBY-3509) The replication log shipper is not notified when a new replication transmitter
Jun 2, 2010
[ https://issues.apache.org/jira/browse/DERBY-3509?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Kristian Waagan closed DERBY-3509.

Multi-Master Replication & CouchDB like replication
Apr 26, 2011
All, I have been investigating various database systems in the hopes of finding the right tool for my application. During my investigation I've discovered that CouchDB offers an ideal set of features for my application except that It's not as…

Closed: (DERBY-3432) Move replication code from org.apache.derby.impl.services.replication to o.a.d.
Jun 2, 2010
[ https://issues.apache.org/jira/browse/DERBY-3432?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Kristian Waagan closed DERBY-3432.

Created: (HDFS-1765) Block Replication should respect under-replication block priority
Mar 17, 2011
Block Replication should respect under-replication block priority

Re: replication
Feb 22, 2011
On 22 February 2011 01:35, Jean-Yves F. Barbier <12uk### @gmail.com> wrote: > On Mon, 21 Feb 2011 21:31:35 +0000, Craig Barnes <cjbar### @gmail.com> > wrote: > > > Hi JY, > > > > There is a section in the…

Re: Replication ?
Mar 4, 2011
On Mar 4, 2011 10:38 PM, "dormando" <dorm### @rydia.net> wrote: > soooooooooooooooooooooooooooooooooooooo. it's more about matching the tool > vs your actual needs. most of the problem here has always been separating > perceieved…