mysql 雙向同步

來源:互聯網
上載者:User

標籤:

1.在兩台mysql上建立使用者,設定許可權  A上添加:    grant replication slave,replication client,reload,super on *.* to ‘sync_user‘@‘192.168.2.220‘ identified by ‘123456‘ with grant option;//用於B訪問  B上:    grant replication slave,replication client,reload,super on *.* to ‘sync_user‘@‘192.168.2.67‘ identified by ‘123456‘ with grant option;//用於A訪問執行  #flush privileges; 更新資料庫使使用者生效。create database testsync;use testsync;create table t_user (    id int primary key auto_increment,    username varchar(20),    age int);在[mysqld]下面添加以下配置# test synchronized at 67log-binserver-id       = 1master-host     =192.168.2.220master-user     =sync_usermaster-pass     =123456master-port     =3306master-connect-retry  =60replicate-do-db        =testsyncreplicate-do-db        =testsync2replicate-ignore-db    =mysql,information_schema,performance_schemaauto_increment_increment=1# test synchronized at 220log-binserver-id       = 2master-host     =192.168.2.67master-user     =sync_usermaster-pass     =123456master-port     =3306master-connect-retry  =60replicate-do-db        =testsyncreplicate-do-db        =testsync2replicate-ignore-db    =mysql,information_schema,performance_schemaauto_increment_increment=2show processlist;insert into t_user values(null, ‘frank‘, 23);select * from t_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= 1binlog-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=1

 

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

mysql 雙向同步

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.