Solved

Promote MySQL Slave to Master and set up a new slave

Posted on 2014-10-03
2
589 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Foreword This is an old article.  Instead of using the MySQL extension that was used in the original code examples, please choose one of the currently supported database extensions instead.  More information is available here: MySQLi / PDO (http://…
Creating and Managing Databases with phpMyAdmin in cPanel.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

631 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