Eric, that is very helpful. Thanks. 

Assuming the master and slave are in sync, is there a reason the
checksums would not match? I would rather not dump the database and run
an external checksum unless I have to. 

--
Eric Robinson
Director of Information Technology
Physician Select Management, LLC
775.720.2082


-----Original Message-----
From: Eric Braswell [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 20, 2006 1:49 AM
To: Robinson, Eric
Cc: mysql@lists.mysql.com
Subject: Re: How to Verify Replication Status?

There are only a very limited set of circumstances where slaves could 
get out of sync, and if everything is set up right, it basically should 
not happen.
See: http://dev.mysql.com/doc/refman/5.0/en/replication-rules.html
And: http://dev.mysql.com/doc/refman/5.0/en/replication-features.html

CHECKSUM TABLE is a good option if it's a read-only table or you can 
stop writes (or just replication) long enough to do that. It only works 
on MyISAM.

You could also do basically the same thing by dumping the data in the 
same way on each server, and running a checksum (e.g. md5sum) or diff 
tool. One thing I have done is to use:

mysqldump --skip-opt {database} > {database}.sql

..on each machine, then diffed the files using "diff" (note *nix bias 
here). Using skip-opt to output inserts on individual lines allows you 
to compare the data to see exactly where any differences are. But this 
won't help you if you can't transfer all the data to one place -- you 
could just do a checksum then on both sides and compare that. Would be 
pretty easy to script that and perform periodic checks.

Eric

-- 
Eric Braswell
Web Manager     MySQL AB
Cupertino, USA


Robinson, Eric wrote:
> I have master-slave replication working fine. However, I worry about
the
> possibility of the master and slave accidentally getting out of
> synchronization. Are there circumstances (other than a direct INSERT
to
> the slave) that could cause the master and slave to be out of sync? Is
> there a way to periodically do some kind of full check to verify that
> the slave is an exact duplicate of the master? I thought of just
> counting the rows in all the tables on both servers, but that only
tells
> part of the story. Is the a more elegant and complete way? Also, the
> servers are separated by a slow WAN link, so transferring the whole
> database across the network is not an option. 
> 
>  
> 
> --
> 
> Eric Robinson
> 
> Director of Information Technology
> 
> Physician Select Management, LLC


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to