AW: Network Storage Redundancy

"Martin Bene" <[email protected]>
Newsgroups gmane.linux.failsafe
Message-ID <[email protected]>
Hi Matt,

> what are my options with failsafe for network replication of 
> storage, as in the assosiated nodes have their own disks not sharing a 
> single disk. Like GFS for example

I've been using drbd with heartbeat for quite some time now; recently I've also used it in a failsafe cluster - actually works quite well.

drbd gives you a block device that's replicated over the network, and (like shared scsi) may only be accessed on one node at a time. One downside is a 2-node limit, if that's no problem for you it's well worth considering.

Some hints on the use of drbd:
 
 - source is available at http://www.linbit.com/en/drbd/
 - at the moment, the version to use is 0.6.1-pre10. 
 - prefered kernel is 2.4.x, 2.2 could work (haven't tested with recent versions though)
 - current version does NOT work with kernels with highmem support turned on, you MUST use a kernel compiled with highmem support turned OFF, so you're limited to 896MB Mem at the moment. This isn't a design limitation, just a bug in the current version.
 - the drbd support in failsafe needs minor modifications in the resource scripts to work with current versions of drbd, see attached patch.
 - system startup: you must start the drbd service before starting the fs_cluster service. drbd service startup ensures that data on both nodes is in sync before continuing.

Within the limits specified above I found drbd to be a quite reliable and usable solution for low-cost clustering.

Bye, Martin
drbd_control.patch (application/octet-stream, 1.8 KB)
--- control	Mon Sep 24 15:35:59 2001
+++ /usr/lib/failsafe/resource_types/drbd/control	Sat Apr 20 14:59:52 2002
@@ -52,19 +52,19 @@
     case $action in
 
 	start)
-	HA_CMD="$DRBDSETUP $Device PRI"
+	HA_CMD="$DRBDSETUP $Device primary"
 	s2_run_command "$HA_CMD" "Setting $Device to PRIMARY"
 	exit_status=$?
 	;;
 
 	stop)
-	HA_CMD="$DRBDSETUP $Device SEC"
+	HA_CMD="$DRBDSETUP $Device secondary"
 	s2_run_command "$HA_CMD" "Setting $Device to SECONDARY"
 	exit_status=$?
 	;;
 
 	restart)
-	HA_CMD="$DRBDSETUP $Device PRI"
+	HA_CMD="$DRBDSETUP $Device primary"
 	s2_run_command "$HA_CMD" "Setting $Device to PRIMARY"
 	exit_status=$?
 	;;
@@ -72,7 +72,7 @@
 	monitor)
 	STATUS=`get_dev_status $Device`
 	case "$STATUS" in
-	    Unconnected|WFConnection|WFReportParams|SyncingAll|SyncingQuick|Connected|Timeout)
+	    StandAlone|Unconnected|BrokenPipe|WFConnection|WFReportParams|SyncingAll|SyncingQuick|Connected|Timeout)
 	    exit_status=0
 	    ;;
 
@@ -88,16 +88,29 @@
         ;;
 	
 	exclusive)
+	STATUS=`get_dev_status $Device`
         DEVNO=`echo $Device | sed -e 's/\/dev\/nb//'`
-        grep -E "^${DEVNO}.*Primary" /proc/drbd >/dev/null 2>&1
+        grep -E "^${DEVNO}.*Primary/" /proc/drbd >/dev/null 2>&1
 	if [ $? = 0 ]; then
-	   s2_log "Found at least one active Primary Node for this device"
-	   s2_log "Cannot go online"
-           exit_status=1
+	   s2_log "$Device is active (Primary) on this Node"
+           exit_status=2
         else
 	   s2_log "resource $Device not running"
 	   exit_status=0
         fi
+	case "$STATUS" in
+		StandAlone)
+			s2_log "resource $Device in StandAlone Mode"
+			s2_log "Cannot go online"
+			exit_status=1
+			;;
+
+		Unconfigured)
+			s2_log "resource $Device Unconfigured"
+			s2_log "Cannot go online"
+			exit_status=1
+			;;
+	esac
 	;;
 
 	*)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.