Solved

Promote MySQL Slave to Master and set up a new slave

Posted on 2014-10-03
2
346 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 24

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

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Suggested Solutions

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

747 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now