mysql 并行fu



Property Value
Command-Line Format --slave-parallel-type=type
Introduced 5.7.2
Type enumeration
Default Value DATABASE
Valid Values

DATABASE

LOGICAL_CLOCK

When using a multi-threaded slave (slave_parallel_workers is greater than 0), this option specifies the policy used to decide which transactions are allowed to execute in parallel on the slave. The possible values are:

  • DATABASE: Transactions that update different databases are applied in parallel. This value is only appropriate if data is partitioned into multiple databases which are being updated independently and concurrently on the master. Only recommended if there are no cross-database constraints, as such constraints may be violated on the slave.

  • LOGICAL_CLOCK: Transactions that are part of the same binary log group commit on a master are applied in parallel on a slave. There are no cross-database constraints, and data does not need to be partitioned into multiple databases.



DATABASE:并行应用更新不同数据库的事务。此值仅适用于将数据分区为多个数据库的情况,这些数据库在主服务器上独立并同时进行更新。只有在没有跨数据库约束的情况下才推荐使用,因为这样的约束可能会违反从站。


LOGICAL_CLOCK:作为主站上相同二进制日志组提交的一部分的事务在从站上并行应用。没有跨数据库约束,数据不需要分区到多个数据库。


当配置 slave_preserve_commit_order=1 参数 的时候,只能使用 LOGICAL_CLOCK 模式。


slave_preserve_commit_order:对于多线程slaves,来保障事务在slave上执行的顺序与relay log中的顺序严格一致,
只有当“slave_parallel_workers”开启时有效;此时“log_bin”、“log_slave_updates”必须开启,
而且“slave_parallel_type”值必须为“LOGICAL_CLOCK”(默认值为DATABASE)。即当多线程开启时,
且根据relay log中事务的逻辑顺序执行statements,是否需要严格保持顺序,默认值为0表示并发执行忽略顺序。
slave_parallel_type默认为DATABASE,能够确保每个DATABASE中的事务顺序严格一致,
但是无法保证所有databases的事务执行顺序也是严格一致的(gap),比如两个事务依次操作了2个DB:A和B,
尽管事务A、B分别被worker X、Y线程接收,但是因为线程调度的问题,有可能导致A的执行时机落后于B。
如果你的事务经常是“跨DB”操作,那么可以考虑使用此参数限定顺序。当此参数开启时,这要求任何worker线程执行的事务时,
只有当前事务中此之前的所有事务都执行后(被其他worker线程执行),才能执行和提交。
(每个事务中,都记录了当前GTID的privious GTID,只有privious GTID被提交后,当前GTID事务才能提交


Property Value
Command-Line Format --slave-parallel-type=type
Introduced 5.7.2
Type enumeration
Default Value DATABASE
Valid Values

DATABASE

LOGICAL_CLOCK

When using a multi-threaded slave (slave_parallel_workers is greater than 0), this option specifies the policy used to decide which transactions are allowed to execute in parallel on the slave. The possible values are:

猜你喜欢

转载自blog.csdn.net/huangliang0703/article/details/79958848
今日推荐