MySQL Forums
Forum List  »  Replication

how to tell if a Master is a Master
Posted by: Chuck Johnson
Date: February 16, 2005 03:04PM

I'm setting up a redundant server environment where there is a single Master and a single Slave, and where both servers can be role-swapped (a controlled failover, where the Slave becomes the Master and the Master becomes the Slave). I'm also writing some JDBC code to query both servers to try and determine if replication is getting "behind" on the Slave.

The problem is, I'm trying to use SQL to determine which server is the Master and which is the Slave.

Issuing "show slave status" will return an empty set if that database has always been a Master and never a Slave. However, if it has ever been a Slave (even though it might not presently be a Slave), then "show slave status" will return its normal data.

The only approach that seems to work(??) is that "show slave status", when run on the current Master, returns an empty string for the name of the "Master_Log_File".

Can I depend on this approach to definitively determine which database is the Master? Is there a better approach that I have missed?

I'm using 4.1.7 at the moment, and moving to 4.1.9 very soon.

Options: ReplyQuote


Subject
Views
Written By
Posted
how to tell if a Master is a Master
4549
February 16, 2005 03:04PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.