原文:http://www.maatkit.org/doc/mk-table-checksum.html#replicate
中文介绍: http://www.bigheaddba.net/article/y2009/387_mysql%E7%AE%A1%E7%90%86%E5%BF%85%E5%A4%87%E5%B7%A5%E5%85%B7maatkit%E8%AF%A6%E8%A7%A3%E4%B9%8B%E5%8D%81%E4%B8%80%EF%BC%88mk-table-checksum%EF%BC%89.html
mysql复制 官方部分文档参考
http://dev.mysql.com/doc/refman/5.1/zh/replication.html#replication-howto 版本较老
http://blog.chinaunix.net/u3/103972/article.php?frmid=137328
高性能mysql这本书很好。
--replicate
type: string
Replicate checksums to slaves (disallows --algorithm CHECKSUM).
This option enables a completely different checksum strategy for a
consistent,
lock-free checksum across a master and its slaves
. Instead of running
the
checksum queries on each server, you run them only on the master. You
specify a
table, fully qualified in db.table format, to insert the results into.
The
checksum queries will insert directly into the table, so they will be
replicated
through the binlog to the slaves.
When the queries are finished replicating, you can run a simple query
on each
slave to see which tables have differences from the master. With the
--replicate-check
option, mk-table-checksum can run the query for you to
make it even easier. See CONSISTENT
CHECKSUMS
for details.
If you find tables that have differences, you can use the chunk
boundaries in a
WHERE clause with mk-table-sync
to help repair them more
efficiently
. See
mk-table-sync
for details.
The table must have at least these columns: db, tbl, chunk,
boundaries,
this_crc, master_crc, this_cnt, master_cnt. The table may be named
anything you
wish. Here is a suggested table structure, which is automatically used
for
--create-replicate-table
(MAGIC_create_replicate):
CREATE TABLE checksum (
db char(64) NOT NULL,
tbl char(64) NOT NULL,
chunk int NOT NULL,
boundaries char(100) NOT NULL,
this_crc char(40) NOT NULL,
this_cnt int NOT NULL,
master_crc char(40) NULL,
master_cnt int NULL,
ts timestamp NOT NULL,
PRIMARY KEY (db, tbl, chunk)
);
Be sure to choose an appropriate storage engine for the checksum
table. If you
are checksumming InnoDB tables, for instance, a deadlock will break
replication
if the checksum table is non-transactional, because the transaction will
still
be written to the binlog. It will then replay without a deadlock on the
slave and break replication with "different error on master and slave."
This
is not a problem with mk-table-checksum, it's a problem with MySQL
replication, and you can read more about it in the MySQL manual.
This works only with statement-based replication (mk-table-checksum
will switch
the binlog format to STATEMENT for the duration of the session if your
server
uses row-based replication)
.
In contrast to running the tool against multiple servers at once,
using this
option eliminates the complexities of synchronizing checksum queries
across
multiple servers, which normally requires locking and unlocking, waiting
for
master binlog positions, and so on. Thus, it disables --lock
,
--wait
,
and --slave-lag
(but not --check-slave-lag
,
which is a way to throttle
the execution speed).
The checksum queries actually do a REPLACE into this table, so
existing rows
need not be removed before running. However, you may wish to do this
anyway to
remove rows related to tables that don't exist anymore. The
--empty-replicate-table
option does this for you.
Since mk-table-checksum uses USE to select the table's database as
its
default database before executing the checksum query, the checksum
queries
should replicate to slaves even if --binlog-do-db settings on the master
filter
out the checksum table's database.
For more information on how
--binlog-do-db
works, see http://dev.mysql.com/doc/en/binary-log.html
.
If the slaves have any --replicate-do-X or --replicate-ignore-X
options, you
should be careful not to checksum any databases or tables that exist on
the
master and not the slaves.
Changes to such tables may not normally be
executed
on the slaves because of the --replicate options, but the checksum
queries
modify the contents of the table that stores the checksums, not the
tables whose
data you are checksumming. Therefore, these queries will be executed on
the
slave, and if the table or database you're checksumming does not exist,
the
queries will cause replication to fail. For more information on
replication
rules, see http://dev.mysql.com/doc/en/replication-rules.html
.
The table specified by --replicate
will never be checksummed itself.
分享到:
相关推荐
MySQL MD5 检查链接 https://dev.mysql.com/doc/refman/8.0/en/verifying-md5-checksum.html =================================== MD5: 95e92084366994464ab377ec196d9ecc =================================== ...
可以使用工具如pt-table-checksum进行检查。 - **故障切换测试**:模拟主服务器故障,验证从服务器能否无缝接管并成为新的主服务器,确保业务不受影响。 5. **智慧容灾与网络安全** - **智慧容灾**:结合现代技术...
binlog_checksum支持(适用于MySQL 5.6.2+用户) 不同版本MySQL发行版的测试套件 用法 从获取最新的JAR。 或者,您可以包括以下Maven依赖关系(可通过Maven Central获得): < groupId>...
MySQL主从数据校验工具是数据库管理中一个关键的组件,尤其在分布式系统或高可用性设置中,如主从复制架构。这类工具的主要目的是确保主数据库与从数据库之间的数据一致性,防止因网络延迟、错误同步或其他问题导致...
1. mk-table-checksum:此工具用于检查主从复制环境中的数据一致性,确保主库和从库的数据同步无误。 2. mk-table-sync:当数据不一致时,该工具可以帮助快速同步表,无需从头开始重载,减少服务中断时间。 3. mk-...
安装完成后,需要在MySQL主库上创建一个具有相应权限的用户,以便pt-table-checksum工具可以正常执行检查任务。 安装配置完毕后,我们就可以执行pt-table-checksum来进行主从一致性检查了。工具的使用需要指定一...
同时,为了确保数据安全,通常会在切换后进行一致性检查,如使用`pt-table-checksum`工具。 总结来说,MHA for MySQL是一个强大的工具,能帮助企业在MySQL环境中实现高可用性,通过自动化故障切换减少服务中断时间...
7. **故障诊断与修复**:学习如何使用SHOW命令、ERROR LOG和general query log来定位问题,以及如何使用pt-table-checksum和pt-table-sync工具进行数据一致性检查和修复。 8. **InnoDB存储引擎**:深入探讨InnoDB...
- `--skip-checksum-table`:数据一致性验证时不使用 `CHECKSUM TABLE`。 - `--skip-data-check`:跳过数据一致性验证。 - `--skip-row-count`:不检查字段数量。 ### 四、实例 以下是一个使用示例,将生成 SQL ...
binlog_checksum = CRC32支持(对于MySQL 5.6.2+用户) 通过TLS进行安全通信 对JMX友好 实时统计 Maven Central的可用性 没有第三方依赖 不同版本MySQL发行版的测试套件 如果您正在寻找其他语言的类似内容,请查看 ...
- 使用`pt-table-checksum`和`pt-table-sync`等工具检查并解决数据不一致问题。 5. **性能优化** - 调整binlog格式和大小,如使用`ROW_FORMAT=COMPRESSED`减小binlog存储空间。 - 设置合适的`replicate-do-db`和...
`pt-table-checksum`和`pt-table-sync`是Percona Toolkit的一部分,用于检查和修复数据不一致的问题。 总的来说,MySQL集群高可用组件通过主从复制、GTID、虚拟IP等技术手段,确保了在面对硬件故障、网络问题或其他...
包含: 1.软件:1102-0x20000_hg255d-squashfs-tftp.checksum2.bin 2.openwrt固件:0508-openwrt-ramips-rt305x-hg255d-squashfs-By_shcl.bin 3.教程连接。
- `pt-table-checksum` 和 `pt-table-sync`:Percona Toolkit中的工具,用于检测和修复主从数据不一致。 - `oracledb`:用于跨平台的复制,支持从Oracle到MySQL的复制。 通过以上介绍,我们可以看出MySQL复制在...
`checksum-maven-plugin`是Maven生态系统中的一个工具,它的主要功能是在构建过程中自动计算项目的各个部分(如JAR、WAR或POM文件)的校验和。这些校验和可以是MD5、SHA-1或其他哈希算法生成的字符串,用于唯一标识...
### 复制工具 - **pt-slave-delay** - **功能**:控制MySQL从服务器的复制延迟,以实现延迟复制。 - **使用场景**:数据备份、读写分离优化。 - **pt-online-schema-change** - **功能**:在线修改表结构,无需...
该项目是GreatSQL社区贡献的开源工具gt-checksum的设计源码,专注于静态数据库校验与修复,兼容MySQL、Oracle等多种数据库。源码集包含131个文件,涵盖99个Go语言文件、9个Markdown文档、4个YAML配置文件、4个Shell...
- 定期检查主从服务器的数据一致性,如通过pt-table-checksum工具。 - 当主服务器发生变化时,如新增表或修改结构,需确保从服务器相应更新。 **常见问题及解决方法** 1. **延迟问题**:如果从服务器落后太多,可能...
3. 工具检查:如Percona的pt-table-checksum和pt-table-sync等工具可自动化检测和修复不一致。 4. 手动审计:针对特定业务场景,手动检查关键表的关键字段。 三、修复策略 1. 重置主从关系:停用从库,重新配置...
- 日志分析工具如pt-table-checksum和pt-table-sync用于检测和修复数据不一致。 7. **复制优化**: - 优化binlog格式和配置,如启用ROW格式,调整binlog_row_image。 - 使用GTID(Global Transaction Identifier...