版本5.6.33
现象:
1、Master能看到slave在连接,show processlist也能看到在dump binlog
代码语言:javascript复制mysql> show slave hosts;
----------- ------ ------ ----------- --------------------------------------
| Server_id | Host | Port | Master_id | Slave_UUID |
----------- ------ ------ ----------- --------------------------------------
| 1001098 | | 3306 | 1001096 | 879ae869-e653-11e8-9f15-f4e9d4b21f90 |
| 1001097 | | 3306 | 1001096 | 3baf55ed-e652-11e8-bb68-f4e9d4b677d0 |
----------- ------ ------ ----------- --------------------------------------
2 rows in set (0.00 sec)
master 配置:
代码语言:javascript复制#开启binlog
log-bin = mysql-bin
binlog_format=row
server_id=1001096
#开始配置主主同步
#96自增步长2 97为1避免自增主键冲突
auto_increment_increment=2
auto_increment_offset=1
#忽略binlog的表
binlog-ignore=mysql
binlog-ignore=information_schema
binlog-ignore=performance_schema
character_set_server=utf8
#函数同步
log-bin-trust-function-creators=1
sync_binlog=1
2、slave状态
代码语言:javascript复制Slave_IO_Running: Yes
Slave_SQL_Running: Yes
slave配置
代码语言:javascript复制#开启binlog
log-bin = mysql-bin
binlog_format=row
server_id=1001098
binlog-ignore-db=information_schema
binlog-ignore-db=performance_schema
binlog-ignore-db=mysql
replicate-do-db=oshop
replicate-ignore-db=performance_schema
replicate-ignore-db=information_schema
replicate-ignore-db=mysql
log-slave-updates
slave-skip-errors=all
slave-net-timeout=6
数据改变后从库未发生改变
根据现象判断,主从网络是通的,并且从库的logfile以及postion也跟着主库在变,日志也没有任何错误信息。
处理办法:
在主库配置上增加
binlog-do-db=dbname
重启主库,同步开始生效。