Deal Alper,
Alper Oguz wrote:
> Hello,
>
> Is there any way to send all binlogs to the slave with a command? I need
> this, because I'm using two servers with Heartbeat and if I up to second
> server (IP alias, Apache, Tomcat etc.), I find some missing rows on the
> slave and this giving error (duplicate) on auto increment columns. Also
> it's produce a data inconsistency of course...
>
> If I can send the all binlogs on master before running the java app.
> server on the slave, it'll be great.
>
> thank you
>
>
I think you misunderstand the replication system that MySQL users. There
are two separate processes on each slave: the SLAVE IO thread and the
SLAVE SQL thread.
The SLAVE IO thread is responsible for connecting to the MASTER and
copying the available contents of the master's binary logs into the
slave's relay logs. This happens continuously while the thread is
running and is limited only by the speeds of the network between the
MASTER and SLAVE and the storage system for the relay logs on the SLAVE
itself.
The SLAVE SQL thread then steps through the contents of the relay logs,
one statement at a time, to repeat the sequence of changes that happened
to the data on the MASTER to the same data on the SLAVE.
There must always be some physical difference between the two systems
(the MASTER and all of its SLAVEs) due to the sequencing of these
physical events:
1) A statement (or row delta) is not written to the MASTER's binary log
until after that statement completes and is committed to the table.
2) Concurrent statements on the MASTER are serialized by the binary log.
3) The SLAVE must stream the binary logs to it's local relay logs
3) the SLAVE must re-execute or re-apply the same changes to its copy of
the data.
You can see how much backlog any one slave may have by checking the
Seconds_Behind_Master value from the SHOW SLAVE STATUS report.
--
Shawn Green, MySQL Senior Support Engineer
Sun Microsystems, Inc.
Office: Blountville, TN