Mirroring Solution
Eric W. Bates
ericx at vineyard.net
Thu Jun 12 10:58:39 PDT 2003
----- Original Message -----
From: "Scott Gerhardt" <scott at g-it.ca>
To: <freebsd-isp at freebsd.org>
Sent: Saturday, June 07, 2003 2:46 PM
Subject: Mirroring Solution
>
> Does anyone know of a good way to mirror two servers running Apache, PHP and
> MySQL on FreeBSD 4.8?
>
> The ideal solution would be real-time (synchronous) or near-real-time
> mirroring. The failover transfer is already taken care of.
>
> I think Rsync run from cron would do a good job of syncing the relatively
> static files (configs, php scripts etc.). I don't think Rsync would be a
> good way of mirroring the MySQL DB though. For that, I'm thinking of using
> MySQL's built in replication.
You are correct. Syncing live mysql data files is a bad idea. At any given instant they cannot really be considered to be in a consistent state because so much information is in memory. If you want to physically copy files, mysqlhotcopy does a pretty good job. However, we have found that using replication (v 4's circular replication is a big improvement) allows us to run mysqlhotcopy on the backup machine rather than the live one (we do a hot dump every 15 minutes). If you have to restore from tape, you will need a dump.
NB: replication is clear-text. (the mysql v4 docs say "no ssl for replication yet") We use stunnel to obscure things.
There is a problem with rsync when the list of files to replicate grows too long. We never really nailed it down; but if you attempt to rsync /usr, it will probably fail. What we see is the sending version of rsync eventually timing out while waiting for the receiving copy; meanwhile the receiving copy ends up hung with no visible errors. Our work-around was a little meta script with a config file listing which trees should be synced between which machines; and it runs smaller rsync jobs in sequence. Oddly enough, we ran into similar failure modes with rdist and unison.
> I think dumping the MySQL data and importing into the slave would be a bit
> clumsy and slow especially when the DB grows quite large.
>
> Does anyone on the list have any recommendations or experience with
> mirroring of this type?
>
> Any other recommendations besides Rsync + MySQL replication?
>
>
>
> Thanks,
>
>
> --
> Scott Gerhardt, P.Geo.
> Gerhardt Information Technologies [G-IT]
>
>
> _______________________________________________
> freebsd-isp at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-isp
> To unsubscribe, send any mail to "freebsd-isp-unsubscribe at freebsd.org"
>
More information about the freebsd-isp
mailing list