We've two nodes running heartbeat/drbd, and one of the services we're using is subversion. What I want to know is: is it safe to run svnserve on both nodes all the time, or should it only run on the active node?
Does svnserve use file-level locking, or is it all in memory? What are the implications of running svnserve without its repositories accessible?
Please let me know if this isn't clear, and I'll try my best to rephrase/clarify. :)
I would presume that as you have
heartbeat
controlling failover, you are running an active/passive DRBD cluster. As such, at time of failoverheartbeat
on passive detects that it must promote itself to active. In this process it (usually) broadcasts the fact it's taking over the primary's VIP then mounts the DRBD disk. This makes the disk accessible to the filesystem, and finallyheartbeat
brings up the necessary software (MySQL, Apache etc) as perharesources
.You should add any extra services you require to start after failover to your
/etc/ha.d/haresources
file in the format:with the appropriate startup script in
/etc/ha.d/resource.d/mysql
(or named relative to the script's function!) - further details in Configuring haresources, the drbd manual and OpenVZ wikiThe crux of the matter is that there is effectively no disk for
svnserve
to read your repositories from until it's taken over as active, as thedrbd
process locks it when in passive mode. It is possible to run DRBD active/active, but it's a relatively new feature and not something I've tried!One gotcha that's not well documented: instead of using the hb_takeover scripts to test failover, simply terminate the
heartbeat
service on the primary and wait for the secondary to take over, watching on both servers withtail -f /var/log/ha-log
. This has the added bonus of testing thedeadtime
,warntime
andinitdead
parameters ofha.cf
which are all important in a real world failover.Yes, you can run 2 svnserve processes simultaneously as long as you're running on a cluster-aware filesystem that doesn't let them both write to the same file at the same time.
You can run svnserve and httpd on the same repo for example without problems.
The repository is locked by a file, when commit occur, the upload goes to a transaction directory, when its complete that txn is applied to the repo atomically. This section of the svn book details how multiple processes can serve svn data simultaneously over different protocols.