MySQL复制环境中使用slave_exec_mod参数

http://blog.csdn.net/staricqxyz/article/details/18889143

先看下slave_exec_mod官方描述

Command-Line Format --slave-exec-mode=mode
Option-File Format slave_exec_mode
System Variable Name slave_exec_mode
Variable Scope Global
Dynamic Variable Yes

Permitted Values
Type enumeration
Default STRICT (ALL)
Default IDEMPOTENT (NDB)
Valid Values IDEMPOTENT
STRICT

Controls whether IDEMPOTENT or STRICT mode is used in replication conflict resolution and error checking.IDEMPOTENT mode causes suppression of duplicate-key and no-key-found errors.

This mode is needed for multi-master replication, circular replication, and some other special replication scenarios for MySQL Cluster Replication. 

  1. SLAVE@root@test 07:21:41>show variables like 'slave_exec_mode';  
  2. +-----------------+--------+  
  3. | Variable_name   | Value  |  
  4. +-----------------+--------+  
  5. | slave_exec_mode | STRICT |  
  6. +-----------------+--------+  
  7. 1 row in set (0.00 sec)  
  8.   
  9. SLAVE@root@test 07:21:42>  

意思是说slave_exec_mod默认是STRICT可选值是IDEMPOTENT,在多主大型复制系统中建议使用IDEMPOTENT值,它避免duplicate-key 和 no-key-found等错误。这个参数是动态的,可以直接修改。

  1. SLAVE@root@test 07:39:58>show variables like 'slave_exec_mode';  
  2. +-----------------+------------+  
  3. | Variable_name   | Value      |  
  4. +-----------------+------------+  
  5. | slave_exec_mode | IDEMPOTENT |  
  6. +-----------------+------------+  
  7. 1 row in set (0.00 sec)  
  8.   
  9. SLAVE@root@test 07:40:09>set global slave_exec_mode='strict';  
  10. Query OK, 0 rows affected (0.00 sec)  
  11.   
  12. SLAVE@root@test 07:40:23>show variables like 'slave_exec_mode';  
  13. +-----------------+--------+  
  14. | Variable_name   | Value  |  
  15. +-----------------+--------+  
  16. | slave_exec_mode | STRICT |  
  17. +-----------------+--------+  
  18. 1 row in set (0.00 sec)  
  19.   
  20. SLAVE@root@test 07:40:24>set global slave_exec_mode='IDEMPOTENT';  
  21. Query OK, 0 rows affected (0.00 sec)  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值