LinuxSoftware

Coding and tramping in Aotearoa / New Zealand

Car insurance

Apr 27

Website Mirroring

, , , , , , , david, Sunday, 12:23 pm

How can you be really confident of your backups? My cunning plan is to mirror my whole website back onto my home box so I can see that I have all the data safely duplicated. When I say “my plan” I really mean I stole the idea off Ralph who has had his web site served both from ihug and from his home box for ~4 years.

The content on mysite is in the MySQL database and various files. The files are easy to mirror with rsync. Getting the database mirrored has been a lot more fun.

I use a SSH tunnel to securely connect the database on the webserver with its mirror on my home box. MySQL can support SSL connections, but using a tunnel seemed easier. I didn’t want to enslave the main MySQL server on my home box so instead I run a new MySQL server with a custom socket and port. I then set this up to connect to the master server on the webserver. The commands for this are in localdbsetup.sh.

Every half an hour I have a cron job run localsync.sh which rsyncs the files across and checks that the MySQL replication is still running. I can check my data is ok just by looking at the mirrored website. Then each night localbkup.sh runs to dump the data from the mirror and tarball it up.

Seems to be working pretty well. Yes, it is massive overkill just for a simple website backup, but it was an interesting project for the long weekend.


Jan 29

More MiniConfs

, , , david, Tuesday, 11:15 pm

Today I have been floating between the MySQL, SysAdmin and Kernel MiniConfs.

Stewart Smith shared what MySQL has in development (for 6.0 or beyond).
Listed on the wiki. The most appealing to me would be true online backups.

In the Kernel MiniConf Christoph Hellwig gave a brief demo of using a emulated hardware device on QEmu to excercise a Linux device driver. This is described as much easier than VHDL. He breezed very quickly through it all. Didn’t follow the details of the code, but he described the device driver as being “so easy a monkey could write it”. He’s promised to upload the code to http://verein.lst.de/~hch, so I’ll have a play with it later and see if I can attain code-monkey status.

Ryan Fursttalks talked on using open source for disaster recovery/backups. With a mention on how much cheaper it is than Veritas software.

Trent Loyd gave plenty of tips on diagnosing MySQL problems. The title “support procedures” had me thinking it was going to be how to fill in bug reports. I was pleasantly surprised instead.

I was very interested in Oliver Hookins’ talk on high availability and replication of a MySQL database cluster. I’m not likely to need to set up such a highly redundant system, but it was still worth learning about and a couple of tools (Heartbeat and MySQL replication) will definitely be useful.

Caught the last half of the kernel lightning talks, and the kernel developers’
panel. Linus is around, but unfortunately for us didn’t join in. I realize now I should have been prepared with a question or two on block device/filesystem ioctls: is the FIBMAP ioctl deprecated? is there a replacement available (as suggested by Ted T’so) yet?

Had an enjoyable and social dinner with the other Kiwis here.