Solved

Promote MySQL Slave to Master and set up a new slave

Posted on 2014-10-03
2
420 Views
Last Modified: 2014-10-30
Hi,

I had two mysql servers running in replication Master(DB1) -> Slave(DB2). DB1 server has died. I have switched all my applications to use DB2.

I now need to re-setup replication. So I need to set up a new server with MySQL (DB3) and then I want to replicate DB2 to DB3 using DB2 as the master and DB3 as the slave.

How do I do this?

I am running a fairly critical system.

Thanks for your help!
0
Comment
Question by:jrm213jrm213
2 Comments
 
LVL 25

Accepted Solution

by:
Tomas Helgi Johannsson earned 250 total points
ID: 40361103
HI!

Just follow the manual for setting up the replication (just select your mysql version ).
It's very simple. :)
http://dev.mysql.com/doc/refman/5.5/en/replication-howto.html

Here are some other tutorials
http://www.rackspace.com/knowledge_center/article/mysql-replication-masterslave
http://plusbryan.com/mysql-replication-without-downtime

Regards,
      Tomas Helgi
0
 
LVL 7

Assisted Solution

by:Stampel
Stampel earned 250 total points
ID: 40370911
Is TomasHelgi answer sufficient or do you need detailed help ?
First you have to start DB2 with --log-bin option so it can start writing logs.
Then use "show master status" on DB2
Then on "DB3" the new slave , use the following commands :

mysql> CHANGE MASTER TO MASTER_HOST='XXX (DB2)', MASTER_USER='XXX', MASTER_PASSWORD='XXX', MASTER_LOG_FILE='mysqld-bin.XXXXXX', MASTER_LOG_POS=XXX;

mysql> START SLAVE;

You will have to replace XXX with the values you got from the "show master status" you used first.
It's not very difficult and there is not much risk.
Tell me if you need realtime help.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More Fun with XML and MySQL – Parsing Delimited String with a Single SQL Statement Are you ready for another of my SQL tidbits?  Hopefully so, as in this adventure, I will be covering a topic that comes up a lot which is parsing a comma (or other…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question