在主从复制中,经常会遇到重复主键的错误,这种错误如果是一个个的skip,重复的值多了的情况下,会很麻烦,可以在配置文件中设置slave_skip_errors参数跳过某一类的错误,但是需要重启实例,也不是很合适,还可以设置slave_exec_mode这个参数
Controls how a slave thread resolves conflicts and errors during replication. IDEMPOTENT mode causes suppression of duplicate-key and no-key-found errors. This mode should be employed in multi-master replication, circular replication, and some other special replication scenarios. STRICT mode is the default, and is suitable for most other cases.
This mode is needed for multi-master replication, circular replication, and some other special replication scenarios for MySQL Cluster Replication. (See Section 18.6.10, “MySQL Cluster Replication: Multi-Master and Circular Replication”, and Section 18.6.11, “MySQL Cluster Replication Conflict Resolution”, for more information.) The mysqld supplied with MySQL Cluster ignores any value explicitly set for slave_exec_mode, and always treats it as IDEMPOTENT.
In MySQL Server 5.6, STRICT mode is the default value. This should not be changed; currently, IDEMPOTENT mode is supported only by NDB and is used when replicating NDB to InnoDB.