LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: Synchronization on LVS.

To: <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: Synchronization on LVS.
From: "Mark" <mark@xxxxxxxxxxxx>
Date: Mon, 23 Oct 2000 13:54:33 +1000
> Another thing, I am going to install mysql database
> server on the primary and backup nodes. How to
> synchoronize the data transactions and make sure that
> when primary is down, the backup node has the updated
>  data found in the primary?

I believe mysql creates a transaction log that you can use for replication
to a standby node. I believe you have to write the replication code yourself
using the logs and a cron job.
here is is strait from the help file:


9.2 The update log

When started with the --log-update=file_name option, mysqld writes a log
file containing all SQL commands that update data. The file is written in
the data directory and has a name of file_name.#, where # is a number that
is incremented each time you execute mysqladmin refresh or mysqladmin
flush-logs, the FLUSH LOGS statement, or restart the server.

If you use the --log or -l options, the filename is `hostname.log', and
restarts and refreshes do not cause a new log file to be generated. By
default, the mysql.server script starts the MySQL server with the -l option.
If you need better performance when you start using MySQL in a production
environment, you can remove the -l option from mysql.server.

Update logging is smart since it logs only statements that really update
data. So an UPDATE or a DELETE with a WHERE that finds no rows is not
written to the log. It even skips UPDATE statements that set a column to the
value it already has.

If you want to update a database from update log files, you could do the
following (assuming your log files have names of the form `file_name.#'):

shell> ls -1 -t -r file_name.[0-9]* | xargs cat | mysql

ls is used to get all the log files in the right order.

This can be useful if you have to revert to backup files after a crash and
you want to redo the updates that occurred between the time of the backup
and the crash.

You can also use the update logs when you have a mirrored database on
another host and you want to replicate the changes that have been made to th
e master database.




Unfortunatly any updates between the cron job would be lost.
Mark



<Prev in Thread] Current Thread [Next in Thread>