> -----Original Message-----
> From: baron.schwa...@gmail.com [mailto:baron.schwa...@gmail.com] On Behalf
> Of Baron Schwartz
> Sent: 2008年12月24日 22:06
> To: Jake Maul
> Cc: mysql@lists.mysql.com
> Subject: Re: On fighting with master-slave replication lag
> 
> On Wed, Dec 24, 2008 at 2:31 AM, Jake Maul <jakem...@gmail.com> wrote:
> > Slightly more complicated (and also probably more accurate- the time
> > reported by show slave status is known to be unreliable in some cases)
> > would be a script that inserts a row into a table, then check the
> > slave over and over till it arrives. Or even better, insert 2
> > values... a timestamp that *you* provide (in a shell script, something
> > like $(date) would work) and a timestamp generated by MySQL....
> > assuming the times are syncronized on the master, slave, and the box
> > you're inserting from, when the insert hits the slave it'll generate
> > it's own timestamp, which you can then subtract *your* timestamp from.
> >
> > There's also a tool in maatkit which does replication tracking,
> > although I've not yet used it. Judging by the other tools in that
> > package though, it's probably pretty decent :).
> 
> It is mk-heartbeat, and it does pretty much what you described,
> although it's been tweaked to be slightly more complex to suit various
> real-world scenarios.
> 
I have read some stuff on http://www.maatkit.org/doc/mk-heartbeat.html and
am interested in this tool. I guess in reality the mk-heartbeat tool checks
the output of show master status on the master with focus on the File and
Position fileds.

mysql> show master status \G
*************************** 1. row ***************************
            File: mysql-bin.000004
                   Position: 3037
                   Binlog_Do_DB: 
                        Binlog_Ignore_DB: 
1 row in set (0.00 sec)

And it can give the delay alert or calculating the delay by checking the
output of show slave status on the slave with the same focus on the
Master_Log_File and Exec_Master_Log_Pos fileds.It compares the two fields
from slave with the two fields from master.

mysql> show slave status \G
*************************** 1. row ***************************
             Slave_IO_State: Waiting for master to send event
                Master_Host: 10.20.15.120
                Master_User: replication1
                Master_Port: 3306
              Connect_Retry: 60
            Master_Log_File: mysql-bin.000004
        Read_Master_Log_Pos: 3037
             Relay_Log_File: localhost-relay-bin.000049
              Relay_Log_Pos: 235
      Relay_Master_Log_File: mysql-bin.000004
           Slave_IO_Running: Yes
          Slave_SQL_Running: Yes
            Replicate_Do_DB: test_db1
        Replicate_Ignore_DB: mysql
         Replicate_Do_Table: 
     Replicate_Ignore_Table: 
    Replicate_Wild_Do_Table: 
Replicate_Wild_Ignore_Table: 
                 Last_Errno: 0
                 Last_Error: 
               Skip_Counter: 0
        Exec_Master_Log_Pos: 3037
            Relay_Log_Space: 235
            Until_Condition: None
             Until_Log_File: 
              Until_Log_Pos: 0
         Master_SSL_Allowed: No
         Master_SSL_CA_File: 
         Master_SSL_CA_Path: 
            Master_SSL_Cert: 
          Master_SSL_Cipher: 
             Master_SSL_Key: 
      Seconds_Behind_Master: 0
1 row in set (0.00 sec)

Am I right?
Or can you provide some info on the detailed description of mk-heartbeat?



> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=xuf...@yuanjie.net




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to