Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Promote MySQL Slave to Master and set up a new slave

Posted on 2014-10-03
2
Medium Priority
?
917 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 26

Accepted Solution

by:
Tomas Helgi Johannsson earned 1000 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 1000 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month9 days, 11 hours left to enroll

877 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