MySQL Bidirectional synchronization

Source: Internet
Author: User

1. Create a user on two MySQL, set permissions on a add: Grant Replication Slave,replication client,reload,super on*. * To'Sync_user'@'192.168.2.220'Identified by'123456'with GRANT option;//for b accessB: Grant replication slave,replication client,reload,super on*. * To'Sync_user'@'192.168.2.67'Identified by'123456'with GRANT option;//for a accessexecute #flush privileges; Update the database to take effect for the user. Create DATABASE Testsync;use testsync;create table T_user (IDintprimary key auto_increment, username varchar ( -), ageint), add the following configuration under [mysqld] # test synchronized at theLog-Binserver-id =1Master-host =192.168.2.220Master-user =Sync_usermaster-pass =123456Master-port =3306Master-connect-retry = -Replicate- Do-db =testsyncreplicate- Do-db =testsync2replicate-ignore-db =mysql,information_schema,performance_schemaauto_increment_increment=1# test Synchronized at -Log-Binserver-id =2Master-host =192.168.2.67Master-user =Sync_usermaster-pass =123456Master-port =3306Master-connect-retry = -Replicate- Do-db =testsyncreplicate- Do-db =testsync2replicate-ignore-db =mysql,information_schema,performance_schemaauto_increment_increment=2show Processlist;insert into t_user values (NULL,'Frank', at);Select* fromT_user;server-id=2Binlog- Do-db=Happybinlog- Do-db=ipaddressmgrreplicate- Do-db=happyreplicate- Do-db=ipaddressmgrreplicate-ignore-db=Mysql,information_schema,performance_schemalog-slave-Updatesslave-skip-errors=Allsync_binlog=1auto_increment_increment=2Auto_increment_offset=2

 log-binserver -id= 1  binlog -do -db=happybinlog - Span style= "color: #0000ff;" >do -db=ipaddressmgrreplicate -do -db=happyreplicate -do -db=< Span style= "color: #000000;" >ipaddressmgrreplicate -ignore-db=mysql,information_schema,performance_ Schemalog -slave-updatesslave -skip-errors= allsync_binlog  =1  auto_increment_increment  =auto_increment_offset  =1  

http://ylw6006.blog.51cto.com/470441/888523

MySQL Bidirectional synchronization

Related Article

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.