[CentOS] Clustering MySQL

Wed Dec 12 04:26:23 UTC 2007
Matt Shields <mattboston at gmail.com>

On Dec 11, 2007 6:10 PM, Karanbir Singh <mail-lists at karan.org> wrote:
> Matt Shields wrote:
> >
> > If this were master-slave, I'd probably do an LVM Snapshot and get a
> > fresh copy of the master db.  The same could be done for
> > master-master.
> >
>
> has a live lvm-snapshot ever worked for you as a real move-data-around
> policy ? you would, at the very least, need to flush in memory data, and
> have a system wide write lock in place while the snapshot is created.
>
> its been a tempting idea, but so far of the few people I know having
> tried this lvm snapshoting, have never actually managed to get it
> working right for mysql dumps. So, would be good to hear from someone
> who has it working.

I didn't put all the details, we have a custom script that we run
which locks the tables, does a flush, starts a lvm snapshot.  We can
then copy the mysql data, when the copy is done we've got a script to
release the snapshot.

The thing you need to remember when you image the server is to make
sure you leave some unused diskspace on your partition.  So for
example if you have a 100GB drive, put it all into the pv and lv, but
only create a 80GB vg.  That gives you 20GB for the snapshot.  Of
course when calculating how much extra space you need, you need to
think about how fast your data grows and how much time you need to do
a copy of the data.  If your snapshot is too small and you outgrow the
snapshot before you've finished copying your data, then the snapshot
will expire.  Works great for us in our master -> multiple slave
environment.  Some of our slaves even have slaves. :)

-- 
-matt