0% found this document useful (0 votes)
52 views11 pages

MY SQL Mirroring

- MySQL mirroring uses master-master replication to increase performance and reliability. It has two MySQL server instances continuously updating each other in real-time. - The steps are: 1) Configure each master for replication, 2) Create replication users, 3) Establish master-slave replication between the masters, 4) Test the mirroring. - Specifics include configuring server IDs and log files, creating replication users, noting master status, connecting the masters via CHANGE MASTER, and verifying replication is running with SHOW SLAVE STATUS. Changes made to one master should replicate to the other.

Uploaded by

eyorica28
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views11 pages

MY SQL Mirroring

- MySQL mirroring uses master-master replication to increase performance and reliability. It has two MySQL server instances continuously updating each other in real-time. - The steps are: 1) Configure each master for replication, 2) Create replication users, 3) Establish master-slave replication between the masters, 4) Test the mirroring. - Specifics include configuring server IDs and log files, creating replication users, noting master status, connecting the masters via CHANGE MASTER, and verifying replication is running with SHOW SLAVE STATUS. Changes made to one master should replicate to the other.

Uploaded by

eyorica28
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

MY SQL MIRRORING

• Master-Master replication in MySQL called mirroring


• used to increase the performance and the reliability of
your server installation
• It’s two MySQL server instances continuously updating
each other in real-time while fulfilling their job
STEPS
1 Configuring Master for Replication
2 Create replication user
3 Establish Master - Slave Replication
4 test master –master replication /mirroring/

Let’s follow the steps


CONSIDER THE FOLLOWING
• We have two machine named as
Master 1 (192.168.2.3) and
Master 2 (192.168.2.4)
Prerequisites:
• Both machines are installed properly with MySQL server
• Open port no 3306 on both machines.
• check that both server are accessible from each other
SETUP THE MASTER IN SYSTEM 1 AND SYSTEM
2
• open mysql configuration file in master system 1 and system 2, default location for this
file is C:\Program Files\MySQL\MySQL Server 5.0\my.ini
• In SERVER SECTION add the following in [mysqld] section
• log_bin ="C:\Program Files (x86)\MySQL\MySQL Server 5.0\mysql-bin.log"
• binlog-do-db=classicmodels
• server-id=1
• For system2 use the server id =2 that the two servers should
have two different server id’s and you can use the database you
want to mirror in the binlo-do-db section
• Then save the configuration file and then close it Restart the MySQL server to
reflect the changes.
CREATING REPLICATION USER ON MASTER

Now move yourself to MySQL from command prompt with following command:
Master 1
• mysql>CREATE USER 'replication_user'@'%' IDENTIFIED BY 'replication';
• mysql>GRANT REPLICATION SLAVE ON *.* TO 'replication_user'@'%';
Master 1
• mysql>CREATE USER 'replication_user'@'%' IDENTIFIED BY 'replication1';
• mysql>GRANT REPLICATION SLAVE ON *.* TO 'replication_user'@'%';

Remember to use different password for master1 and master 2


• Before changing master host, please note following things on each of your master using
SHOW MASTER STATUS COMMAND
MASTER 1

MASTER 2

Luckily we have the same result for both masters take a note for the values of File and Position
CONNECT FROM ONE MASTER TO ANOTHER
change master host in both of your server:
Master 1
CHANGE MASTER TO MASTER_HOST = '192.168.2.4', MASTER_USER =
'replication_user', MASTER_PASSWORD = 'replication1', MASTER_LOG_FILE = 'mysql-
bin.000001', MASTER_LOG_POS = 98;

Master 2
CHANGE MASTER TO MASTER_HOST = '192.168.2.3', MASTER_USER =
'replication_user', MASTER_PASSWORD = 'replication', MASTER_LOG_FILE = 'mysql-
bin.000001', MASTER_LOG_POS = 98;
Remember to use stop slave command before CHANGE MASTER
Master 1

Master 2
• Start the slave you stopped with START SLAVE command ;
• Then type show slave status\G command in both systems
Master 1 master 2

Note the three values are like this :


• Slave_IO_Running: Yes
• Slave_SQL_Running: Yes Slave_IO_State: Waiting for master to send event
TEST MASTER –MASTER REPLICATION \
MIRRORING\
• And that’s it.  We now have two different instances of MySQL server running with a
Master-Master replication scheme
• You can create ,drop or alter the database and see the change you made on master1 on
master to and vise versa .

You might also like