亚洲福利色视频_久久久中文久久久无码_97国产免费全部免费观看_亚洲乱码视频在线观看

長(zhǎng)治網(wǎng)站建設(shè)
MySQL 5.5 主從雙向同步

在Red Hat Enterprise Linux平臺(tái),利用MySQL主從同步原理,實(shí)現(xiàn)MySQL雙向同步
MySQL版本:5.5.28
操作系統(tǒng):RHEL 5.8 32bit

Server1:192.168.1.1
配置:my.cnf


  1. server-id = 1
  2. binlog-do-db = testdb
  3. binlog-ignore-db = mysql
  4. log-slave-updates
  5. replicate-do-db = testdb
  6. replicate-ignore-db = mysql


同步testdb數(shù)據(jù)庫,這里不對(duì)mysql數(shù)據(jù)庫進(jìn)行同步
新增同步用戶:


  1. grant replication slave on *.* to slaveuser@192.168.1.2 identified by '123456'; 


啟動(dòng)Sever1;


  1. service mysql start


查看MySQL同步binlog文件名以及pos值:


  1. show master status;


Server2:192.168.1.2
配置:my.cnf


  1. server-id = 2
  2. binlog-do-db = testdb
  3. binlog-ignore-db = mysql
  4. log-slave-updates
  5. replicate-do-db = testdb
  6. replicate-ignore-db = mysql


與Sever1配置基本相同,只是server-id不同,而且不能相同,另外記得在[mysqld]配置區(qū)域里配置開啟二進(jìn)制日志記錄:log-bin = mysql-bin
新增同步用戶:


  1. grant replication slave on *.* to slaveuser@192.168.1.1 identified by '123456';


啟動(dòng)Server2:


  1. service mysql start


配置同步:


  1. mysql>change master to master_host='192.168.1.1',
  2. mysql>master_user='slaveuser',
  3. mysql>master_password='123456',
  4. mysql>master_port=3306,
  5. mysql>master_log_file='mysql-bin.000020',
  6. mysql>master_log_pos=107;
  7. mysql>slave start;
  8. mysql>show slave statusG;


2006-2014 IT0355.com 山西中聯(lián)科創(chuàng)科技有限公司. All Rights Reserved.
電話:0355-3728808 傳真:0355-3728808
ICP備案號(hào):晉ICP備06003721號(hào)本站已通過國(guó)際W3C認(rèn)證
關(guān)鍵字:中聯(lián)科創(chuàng),長(zhǎng)治網(wǎng)站建設(shè),長(zhǎng)治網(wǎng)站推廣,長(zhǎng)治網(wǎng)絡(luò)工程,長(zhǎng)治軟件開發(fā),山西網(wǎng)站建設(shè),山西軟件開發(fā) 長(zhǎng)治五金網(wǎng)