Re: Webserver Redundacy
On Thu, Mar 01, 2007 at 04:40:33PM +0800, Thomas Goirand wrote:
> I might sound like a dumb, but I haven't used NFS so much. In fact, I
> run many small servers, and I don't have much experience of running
> very big sites with multiple servers (only did multiple MySQL server
> for a single web server at the moment), and when I needed it, I asked
> my partners to do the job for me (as they have such experience). Could
> any of you explain in details what the locking issue is, and how to
> avoid it?
IIRC, it's that flock doesn't work on NFS mounts.
the traditional way to do NFS-safe locking is to check for the existence
a FILENAME.lock file before you open it for write. if it exists then
wait until it's gone before proceeding. if/when it doesn't exist, create
the .lock file and then open your file for write. write data to it.
close it. remove the .lock file.
that's, e.g., what you have to do to write to mbox format mailboxes on NFS
craig sanders <email@example.com>
Currently listening to: Shpongle - Monster Hit
"Civilization has little to fear from educated people and brain-workers.
In them the replacement of religious motives for civilized behaviours by
other, secular motives, would proceed unobtrusively..."
[Sigmund Freud, 1927]