4、常见问题
(1)(1)从库无法复制 Slave_SQL_Running 为No,Seconds_Behind_Master:Null
原因:1)有程序可能在从DB上进行写操作;
2)可能是从DB服务器重启,事物回滚造成;
解决:1)MySQL> slave stop;
mysql> set GLOBAL SQL_SLAVE_AKIP_COUNTER=1;
mysql> slave start;
2)手动同步先停止master的写操作
mysql>show master status;
+------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000001 | 98 | testdb | mysql |
+------------------+----------+--------------+------------------+
然后到从库上手动同步
mysql> change master to
>master_host=’192.168.113.9’,
>master_user=’’repuser,
>master_password=’111111’,
>master_porte=’3306’,
>master_log_file=’ mysql-bin.000001’,
>master_log_pos=98;
mysql> slave start
(2)从库无法复制 Slave_IO_Running为No,Seconds_Behind_Master:Null
解决:1)测试与主DB网络3306端口的连通性
2)重启主DB MySQL---mysql> show master status;---找到对应的File字段内容
3)从DB上 mysql> stop slave;
mysql> change master to master_host='192.168.113.9',master_user='repuser',master_password='111111',master_port=3306,Master_Log_File='mysql-bin.000001',master_Log_Pos=98;
mysql> start slave;