MariaDB从服务器一些细微差异
前述
- 在做从服务器手动修改数据导致主从复制冲突出现错误的场景发现
- 无论从服务器使用任何DML DDL语言都无法永久生效
- 只有使用DML+commit语句配合才会导致冲突错误
官方文档如下
Starting with MariaDB 10.3.20 we have fixed some issues related to read only slaves:
- CREATE, DROP, ALTER, INSERT and DELETE of temporary tables are not logged to binary log, even in statement or mixed mode. With earlier MariaDB versions, one can avoid the problem with temporary tables by using binlog_format=ROW in which cases temporary tables are never logged.
- Changes to temporary tables created during read_only will not be logged even after read_only mode is disabled (for example if the slave is promoted to a master).
- The Admin statements ANALYZE, CHECK and REPAIR will not be logged to the binary log under read-only.
大概意思如下
从MariaDB 10.3.20开始,我们修复了一些与read only slaves有关的问题:
- 即使在语句或混合模式下,临时表的CREATE,DROP,ALTER,INSERT和DELETE也不会记录到二进制日志中。使用早期的MariaDB版本,可以通过使用binlog_format = ROW避免临时表出现问题,在这种情况下,永远不会记录临时表。
- read_only即使read_only禁用了模式(例如,如果将从属服务器提升为主服务器),在此期间创建的临时表的更改也不会记录下来。
- Admin语句ANALYZE,CHECK和REPAIR不会以只读方式记录到二进制日志中。
综上所述,
- MariaDB从服务器设置完成后,二进制日志不记录DDL DML语言
- 从服务器数据变化以relay-log为主
- 此项改动相当于从服务器所有人为操作变成了一个大事务
- 就算服务器变量 autocommit=1 启用状态也没有效果
- 如果想强行生效,可以使用commit命令提交所操作的命令
- 这些设置变相的保护了从服务器的安全性