[DRBD-user] How to become primary when the other node gets dead?

Lars Ellenberg Lars.Ellenberg at linbit.com
Wed Oct 13 16:51:44 CEST 2004

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.

/ 2004-10-13 16:23:49 +0200
\ Richard NAGY:
> Hello all,
> I'm facing a problem with drbd and heartbeat. When the master node is 
> powered off, the secondary node stays in a secondary state. It does not 
> want to become primary. It says that the other pear is primary, but it 
> is dead!

that is when heartbeat deadtime is considerably smaller than drbd ping time.
heartbeat should try again, if starting a resource failed ...
oopsie, exit code of drbddisk was always zero ... hm...

you could increase the ha-deadtime, decrease the drbd-ping time,
but maybe the below patch already helps you.

	Lars Ellenberg

Index: DRBD/drbd07/scripts/drbddisk
--- DRBD/drbd07/scripts/drbddisk	(revision 1586)
+++ DRBD/drbd07/scripts/drbddisk	(working copy)
@@ -23,10 +23,18 @@
 case "$CMD" in
-	$DRBDADM primary $RES
+    	# try several times, in case heartbeat deadtime
+	# was smaller than drbd ping time
+    	try=6
+	while true; do
+		$DRBDADM primary $RES && break
+		let "--try" || exit 20
+		sleep 1
+	done
-	$DRBDADM secondary $RES
+    	# exec, so the exit code of drbdadm propagates
+	exec $DRBDADM secondary $RES
 	if [ "$RES" = "all" ]; then

More information about the drbd-user mailing list