>  기사  >  데이터 베이스  >  MySQL复制环境中使用slave_exec_mod参数

MySQL复制环境中使用slave_exec_mod参数

WBOY
WBOY원래의
2016-06-07 17:34:591146검색

先看下slave_exec_mod官方描述 Command-Line Format --slave-exec-mode=mode Option-File Format slave_exec_mode System

先看下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.

[plain] view plaincopyprint?
SLAVE@root@test 07:21:41>show variables like 'slave_exec_mode'; 
+-----------------+--------+ 
| Variable_name  | Value  | 
+-----------------+--------+ 
| slave_exec_mode | STRICT | 
+-----------------+--------+ 
1 row in set (0.00 sec) 
 
SLAVE@root@test 07:21:42> 

SLAVE@root@test 07:21:41>show variables like 'slave_exec_mode';
+-----------------+--------+
| Variable_name  | Value  |
+-----------------+--------+
| slave_exec_mode | STRICT |
+-----------------+--------+
1 row in set (0.00 sec)

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

[plain] view plaincopyprint?
SLAVE@root@test 07:39:58>show variables like 'slave_exec_mode'; 
+-----------------+------------+ 
| Variable_name  | Value      | 
+-----------------+------------+ 
| slave_exec_mode | IDEMPOTENT | 
+-----------------+------------+ 
1 row in set (0.00 sec) 
 
SLAVE@root@test 07:40:09>set global slave_exec_mode='strict'; 
Query OK, 0 rows affected (0.00 sec) 
 
SLAVE@root@test 07:40:23>show variables like 'slave_exec_mode'; 
+-----------------+--------+ 
| Variable_name  | Value  | 
+-----------------+--------+ 
| slave_exec_mode | STRICT | 
+-----------------+--------+ 
1 row in set (0.00 sec) 
 
SLAVE@root@test 07:40:24>set global slave_exec_mode='IDEMPOTENT'; 
Query OK, 0 rows affected (0.00 sec) 

linux

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.