[ENBD] Block devices - do they allow a real mirror?

Peter T. Breuer ptb@it.uc3m.es
Tue, 12 Sep 2000 09:53:09 +0200 (MET DST)


"A month of sundays ago Adam Goryachev wrote:"
> I have one server with a 'data' disk. I have 4 servers, all with apache
> running serving up web pages all pretty much identical, they all have their
> various system setup plus a single large disk (30Gb). What I want is for
> each of the 4 servers to have a local copy of what is on the single master
> system (ie, for a simple GET request it doesn't have to ask the server for
> the file). Also, if the master dies for any reason (ie, disk drive crash or
> similar) then I take it off-line etc, install a new disk, format it, and
> put it back on-line. Will the master re-build its data disk from all the
> clients??

This is up to your mirroring software, not to NBD. The best way to
think of an NBD is as a "long pair of wires". Nothing more. It makes
a remote resource act as a local one, so you can mirror to it locally.

The setup you envisage is not clear to me. Are you trying to use
the master like an NFS server? That is, all the changes made by
all the slaves are sent back to it? How do the slaves get to see each
others changes? That would happen on NFS, but not under any other
mechanism (AFS, CODA, blah blah excepted!).

> How does it work when one client runs a CGI (say a counter script) which
> relies on using a lock file (O_EXCL|O_CREAT) will this work properly?? How

Locks work properly over nbd, but that is not your problem.

> about the updated text file (contains a single line of the form

Updated? That's NFS you are thinking of!

> "<date>:<number>") is that going to be the same on all the machines??

Only if you use NFS, which seems to be what you are thinking of.

> In some respects it also sounds like a cross between NFS and a loopback
> filesystem thing, ie, share a file over NFS and then make the local system

You are thinking complicated where you should be thinking simple. An
NBD is only a "long pair of wires".

What you want is for 4 slaves to make changes independently to a remote
master copy and see each others changes. That's NFS. If you want to
backup the master copy on a separate machine, then you have to do the
mirroring on the master, to an NBD device, using RAID. When the master
dies the other end of the NBD device becomes the master (via your
putting up an IP alias for it, resetting the NFS mounts on the slaves,
etc. etc.). When the real master wants to come back up, you have to
sync it with the mirror, using RAID.

Peter