MySQL Variables pseudo_slave_mode 数据库 参数变量解释及正确配置使用
本站中文解释
pseudo_slave_mode 参数是MySQL复制参数,它用于控制MySQL在复制过程中是否模拟复制从服务器行为。
它可以设置为ON或OFF,默认为OFF。当这个参数设置为ON时,MySQL在复制时将模拟从服务器行为,这可以提高复制的效率。
要设置pseudo_slave_mode参数,需要在MySQL的配置文件中添加以下代码:
replication_pseudo_slave_mode = ON
保存后,重新启动MySQL服务。
官方英文解释
pseudo_slave_mode
System Variable | pseudo_slave_mode |
---|---|
Scope | Session |
Dynamic | Yes |
Type | Boolean |
This system variable is for internal server use.
pseudo_slave_mode
assists
with the correct handling of transactions that originated on
older or newer servers than the server currently processing
them. mysqlbinlog sets the value of
pseudo_slave_mode
to true
before executing any SQL statements.
pseudo_slave_mode
has the
following effects on the handling of prepared XA transactions,
which can be attached to or detached from the handling session
(by default, the session that issues
XA START
):
-
If true, and the handling session has executed an
internal-useBINLOG
statement, XA transactions are automatically detached from
the session as soon as the first part of the transaction
up toXA
finishes, so they can be committed or
PREPARE
rolled back by any session that has the
XA_RECOVER_ADMIN
privilege. -
If false, XA transactions remain attached to the handling
session as long as that session is alive, during which
time no other session can commit the transaction. The
prepared transaction is only detached if the session
disconnects or the server restarts.