Editing
Advanced DRBD mount issues
(section)
From Linix VServer
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Solution 4: Modifying Heartbeat's Drbddisk Script == This solution/principle is valid for the combination of Vserver + DRBD + Heartbeat, where the latter is used to transfer virtual servers between the nodes of a [http://en.wikipedia.org/wiki/High_availability HA] cluster. "Out of the box", Heartbeat will reboot the cluster node if it cannot unmount the vserver mount point when it tries to shut down a virtual server. Unfortunately, this happens rather often if there is more than one virtual server on a cluster. Every time a vserver is about to be shut down, the vserver itself is getting stopped, then its file system is unmounted, and the underlaying DRBD device is set into "secondary" state (to allow the other node of the cluster to take over the DRBD block device). Now, if there are any references to the vserver moint point remaining in the namespaces of any other running virtual server (copies from the master namespace when a vserver is started), switching the DRBD device into "secondary" mode will fail, and, alas, unmounting the mount point consequentially also. There goes your cluster node... To cirumvent this problem I wrote a little script, which should be hooked into the Heartbeat DRBD control script "/usr/etc/ha.d/resource.d/drbddisk", right before the line "exec $DRBDADM secondary $RES" in the "stop" branch. It removes the mount point of the virtual server that is about to be shut down from all running virtual server contextes: <pre> VNSPACE=/usr/local/sbin/vnamespace for CTX in `/usr/local/sbin/vserver-stat | tail +3 | awk '{print $1}'` do MPOINT="`$VNSPACE -e $CTX cat /proc/mounts | grep $RES | awk '{print $2}'`" echo Unmounting mount point $MPOINT from within context $CTX ### MOUNT POINT IS COMPULSORY. DEVICE NAME DOES NOT WORK!!! $VNSPACE -e $CTX /bin/umount $MPOINT || continue; done # here shall be the original line then (uncommented, of course ;-)) # exec $DRBDADM secondary $RES </pre> [[Category:Documentation]]
Summary:
Please note that all contributions to Linix VServer may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Linix VServer:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Page actions
Page
Discussion
Read
Edit
History
Page actions
Page
Discussion
More
Tools
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
About
Overview
Paper
News
Developers
Donations
Search
Getting Started
Downloads
FAQs
Documentation
Support
Participate
How to participate
Report a Bug
Communicate
Teams/Projects
Hall of Fame
Resources
Archives
Recent Wiki Changes
Pastebin
Related Projects
VServer Hosting
Happy VServer Users
Tools
What links here
Related changes
Special pages
Page information