0
votes

I am trying to configure MySQL databases using the Master-Slave replication. Before I realized that I had to set up my environment using this replication, I already have 2 separate servers running their own MySQL DB. Each of these servers are configured the exact same. The MySQL DB are configured with hundreds of tables.

Is there a way that i can set up (Master-Slave) Replication using the configured DB's? Or will i have to start from scratch and configure the replication first and then load in all the DB tables?

2
This type of question is more suitable for dba.stackexchange.com/help/on-topic - Alon Eitan

2 Answers

1
votes

You can delete all data from one of the servers. Remaining one with the data will be your Master. Then use mysqldump to backup all the data and insert it to the slave.

Take a look for the detailed instructions on the page below:

https://livecaller.io/blog/how-to-set-up-mysql-master-slave-replication/

0
votes

If the data is exactly same in both the MySQL database then you can start master slave replication, but you need to be sure that the data is same. MySQL will not check that, and if there is some discrepancy in the primary key then it will throw error immediately after next DML statement.

To be on a safer side, drop the database from one server, and restore it using the MySQL dump of another server. This will give the surety that database is same on both the server.

Take the reference from the below link to establish replication between two MySQL servers. https://www.digitalocean.com/community/tutorials/how-to-set-up-master-slave-replication-in-mysql