Master-Slave
1、在Master节点上配置<br>server_id=1<br>binlog-do-db=test<br>binlog_format=mixed<br>log-bin=/var/log/mysql/mysql-bin<br>
2、创建用于复制的用户<br>CREATE USER 'repl'@'%'<br>GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%' identified by '123';<br>
3、查看binlog信息<br>show master status;<br>+------------------+----------+--------------+------------------+-------------------+<br>| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |<br>+------------------+----------+--------------+------------------+-------------------+<br>| mysql-bin.000002 | 344 | test | | |<br>+------------------+----------+--------------+------------------+-------------------+<br>
4、在Slave节点配置<br>server_id=2<br>binlog-do-db=test<br>binlog_format=mixed<br>log-bin=/var/log/mysql/mysql-bin<br>
5、执行命令<br>change master to \<br>master_host="node01", \<br>master_user="repl", \<br>master_password="123", \<br>master_log_file="mysql-bin.000002", \<br>master_log_pos=120;<br>
6、启动start slave<br> 停止stop slave
问题
Could not execute Delete_rows event on table test.t_user; Can't find record in 't_user', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000002, end_log_pos 761<br>stop slave;<br>set global sql_slave_skip_counter=1;<br>start slave;