How to check if two large tables are identical?

I have 2 servers that start one as a master and the other as a slave. I want to check the weather, and the tables have the same data. How can I check and confirm this? The table contains over 23 million rows.

Also as a first step I tried to run CHECKSUM TABLE tbl;

But I get this error after 60 seconds: ERROR 2013 (HY000): Lost connection to MySQL server during query

Please advice.

+3
source share
3 answers

You can also use mk-table-checksumwhich is part of the Maatkit utilities.

http://www.maatkit.org/doc/mk-table-checksum.html

+2
source

, 100% , , - - , MySQL.

The method works with timestamps that are inserted into the table and checked every 20 seconds. Together with the status that returns SHOW SLAVE STATUS \G, you get accurate statistics about the current state.

You see how many statements obey the master or replication errors. If there are no errors or pending statements, you should be good enough to assume that at time t your tables are in sync.

0
source

Source: https://habr.com/ru/post/1790437/


All Articles