MySQL dual master (Master) architecture

Source: Internet
Author: User

128 Machine:

[Email protected] ~]#/etc/init.d/mysqld restartshutting down MySQL. success! Starting MySQL. success!


129 machine:

[Email protected] ~]#/etc/init.d/mysqld restartshutting down MySQL. success! Starting MySQL. success!


First with master and slave:

128 on the machine:

Copy the data and transfer it to 129 machines.

[[email protected] ~]# mysqldump-uroot-p123456--all-databases >/tmp/mysqlall.sql[[email protected] ~]# scp-r/tmp/ Mysqlall.sql 192.168.65.129:/tmp/


mysql> grant replication Slave on * * to ' REPL ' @192.168.65.129 identified by ' 123456 ';mysql> flush privileges;

Test machine data changes basically no, so we don't lock the table.


129 on the machine:

[Email protected] ~]# mysql-uroot-p123456 </tmp/mysqlall.sql

mysql> stop Slave; Query OK, 0 rows Affected (0.00 sec) mysql> Change master to master_host= ' 192.168.65.128 ', master_user= ' repl ', MASTER_PA Ssword= ' 123456 ', master_log_file= ' thermos.000001, master_log_pos=420; Query OK, 0 rows affected, 2 warnings (0.01 sec) mysql> start slave; Query OK, 0 rows affected (0.01 sec) mysql> Show slave status\g

Master-Slave synchronization complete


Primary Master synchronization:

129 on the machine:

Change/etc/my.cnf, add Log_bin

[Email protected] ~]#/etc/init.d/mysqld restartshutting down MySQL. success! Starting MySQL. success!


mysql> grant replication Slave on * * to ' REPL ' @192.168.65.128 identified by ' 123456 '; Query OK, 0 rows Affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows Affected (0.00 sec)

128 on the machine:

mysql> stop Slave; Query OK, 0 rows Affected (0.00 sec) mysql> Change master to master_host= ' 192.168.65.129 ', master_user= ' repl ', MASTER_PA Ssword= ' 123456 ', master_log_file= ' alex.000001 ', master_log_pos=420; Query OK, 0 rows affected, 2 warnings (0.01 sec) mysql> start slave; Query OK, 0 rows Affected (0.00 sec) mysql> Show slave status\g


Test the primary master

128 on

129 on

(already more Micheal library)


129 on

128 on

(More Jackson Library)


Self-study, do not know the right or not, if there is a mistake, look correct!

MySQL dual master (Master) architecture

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.