[DRBD-user] KVM / Heartbeat Master->Server Takeover

Robert P robp236 at gmail.com
Wed Sep 14 18:43:10 CEST 2011

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


Hello,

i've installed DRBD / Heartbeat (Ubuntu 10.04 LTS) on two HP Servers.

The final solution would be:
The KVM - Image is in the mirrored partition (resp. /dev/drbd0), and it
should start on that machine, which becomes the drbd-"master" automatically.


Now i have a strange problem, and i still don't know on how to figure that
out with Google :-(
The Master-Server is up, /dev/drbd0 is mounted, and the virtual machine with
the image under /dev/drbd0 is running. eth0:0 also got an ip-Adress from
heartbeat.
On the Slave Server, no ip is assigned to eth0:0, and /dev/drbd0 isn't
mounted so there's also no virtual machine running.

When i disconnect the ethernet cable, so that the heartbeat is missing from
the master, on the Slave:  /dev/drbd0 gets mounted correctly, eth0:0 gets an
ip-Adress as configured, and the virtual machine is starting up.
BUT: /dev/drbd0 is still mounted on the master server, and the virtual
machine on the master server also stays up. eth0:0 has also still the same
adress as before i unplugged the cable.
And that should not be, because this would cause to have 2 Servers with same
IP in the network.

The next thing is, that i'm not quite sure if this the correct way to start
up a KVM-VM with heartbeat.

Here are my configuration files:

----

/etc/heartbeat/ha.cf:

debugfile               /var/log/ha-debug
logfile                 /var/log/ha-log
logfacility             local0
udpport                 694
keepalive               1
deadtime                10
warntime                5
initdead                15
bcast                   eth1
node                    hpsrv-master hpsrv-slave
crm                     off
nice_failback           on
auto_failback           off

------

/etc/heartbeat/haresources

hpsrv-master 192.168.118.99/24/eth0     drbddisk::ylogSync
Filesystem::/dev/drbd0::/media/sync::ext3 startAph.sh::start

-----

/etc/heartbeat/authkeys

auth 3
#1 crc
#2 sha1 test-ha
3 md5 pw_sync

-----

/etc/init.d/startAph.sh

#!/bin/bash

#! /bin/sh
### BEGIN INIT INFO
# Provides:          urandom
# Required-Start:    $remote_fs
# Required-Stop:     $remote_fs
# Default-Start:     S
# Default-Stop:      0 6
# Short-Description: Save and restore random seed between restarts.
# Description:       This script saves the random seed between restarts.
#                    It is called from the boot, halt and reboot scripts.
### END INIT INFO

TAPAPH_A=tapAphA

case "$1" in
    start|"")
        echo "Staring Aphrodite"
        /usr/bin/kvm -enable-kvm -hda
/media/sync/KVM-Aphrodite/KVM_Aphrodite_Ubuntu11.04_32bit_Master.img \
        -net nic,model=rtl8139 -net
tap,ifname=${TAPAPH_A},script=/media/sync/KVM-Aphrodite/qemu-ifup-aphA, \
         downscript=/media/sync/KVM-Aphrodite/qemu-ifdown-aphA

        ;;
      stop)
        echo "Stopping Aphrodite"
        killall kvm
        ;;
      status)
        ;;
      *)
        exit 3
        ;;
esac

:

-----

/etc/drbd.conf

# You can find an example in  /usr/share/doc/drbd.../drbd.conf.example

#include "drbd.d/global_common.conf";
#include "drbd.d/*.res";

# Globale Angaben ###
global {
    # an Statistikauswertung auf usage.drbd.org teilnehmen?
    usage-count yes;
}
### Optionen, die an alle Ressourcen vererbt werden ###
common {
  syncer {
    rate 1000M;
  }
}

resource ylogSync {
  # Protokoll-Version
  protocol C;

  syncer {
    # Geschwindigkeit der HA-Verbindung
    rate 1000M;
  }
  on hpsrv-master {
    ### Optionen für Master-Server ###
    # Name des bereitgestellten Blockdevices
    device     /dev/drbd0;
    # dem DRBD zugrunde liegendes Laufwerk
    disk       /dev/cciss/c0d0p7;
    # Adresse und Port, über welche die Synchr. läuft
    address    10.110.214.1:7788;
    # Speicherort der Metadaten, hier im Laufwerk selbst
    meta-disk  internal;
  }
  on hpsrv-slave {
    ## Optionen für Slave-Server
    # Name des bereitgestellten Blockdevices
    device     /dev/drbd0;
    # dem DRBD zugrunde liegendes Laufwerk
    disk       /dev/cciss/c0d0p7;
    # Adresse und Port, über welche die Synchr. läuft
    address    10.110.214.2:7788;
    # Speicherort der Metadaten, hier im Laufwerk selbst
    meta-disk  internal;
  }
}

----

/var/log/ha-log (Master Server)

root at hpsrv-master:/etc/heartbeat# tail /var/log/ha-log
harc[5171]:    2011/09/14_18:28:55 info: Running /etc/ha.d//rc.d/status
status
harc[5186]:    2011/09/14_18:28:55 info: Running /etc/ha.d//rc.d/status
status
mach_down[5201]:    2011/09/14_18:28:55 info:
/usr/share/heartbeat/mach_down: nice_failback: foreign resources acquired
mach_down[5201]:    2011/09/14_18:28:55 info: mach_down takeover complete
for node hpsrv-slave.
Sep 14 18:28:55 hpsrv-master heartbeat: [4004]: info: mach_down takeover
complete.
harc[5235]:    2011/09/14_18:28:55 info: Running /etc/ha.d//rc.d/status
status
Sep 14 18:28:55 hpsrv-master heartbeat: [4004]: info: Heartbeat shutdown in
progress. (4004)
Sep 14 18:28:55 hpsrv-master heartbeat: [5250]: info: Giving up all HA
resources.
ResourceManager[5264]:    2011/09/14_18:28:55 info: Releasing resource
group: hpsrv-master 192.168.118.99/24/eth0 drbddisk::ylogSync
Filesystem::/dev/drbd0::/media/sync::ext3 startAph.sh::start
ResourceManager[5264]:    2011/09/14_18:28:55 info: Running
/etc/init.d/startAph.sh start stop

/var/log/ha-log (Slave Server)

root at hpsrv-slave:~# tail /var/log/ha-log
Filesystem[4417]:    2011/09/14_17:43:48 INFO:  Resource is stopped
ResourceManager[4175]:    2011/09/14_17:43:48 info: Running
/etc/ha.d/resource.d/Filesystem /dev/drbd0 /media/sync ext3 start
Filesystem[4486]:    2011/09/14_17:43:48 INFO: Running start for /dev/drbd0
on /media/sync
Filesystem[4480]:    2011/09/14_17:43:48 INFO:  Success
Sep 14 17:43:58 hpsrv-slave heartbeat: [4106]: info: Local Resource
acquisition completed. (none)
Sep 14 17:43:58 hpsrv-slave heartbeat: [4106]: info: local resource
transition completed.
Sep 14 18:36:20 hpsrv-slave heartbeat: [4106]: info: Link hpsrv-master:eth1
up.
Sep 14 18:36:20 hpsrv-slave heartbeat: [4106]: info: Status update for node
hpsrv-master: status active
Sep 14 18:36:22 hpsrv-slave heartbeat: [4106]: info: all clients are now
paused
Sep 14 18:36:29 hpsrv-slave heartbeat: [4106]: info: all clients are now
resumed

--------

Any help on that would be great.

Thank You.
Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linbit.com/pipermail/drbd-user/attachments/20110914/eaf332c4/attachment.htm>


More information about the drbd-user mailing list