OK, here is a recipe to see this problem. I hope all the steps are here!
(0) Install drbd8-utils and heartbeat. (1) Create a fake disk dd if=/dev/zero of=drbd_disk count=1M bs=1 losetup /dev/loop0 ./drbd_disk (2) Create /etc/drbd.conf. I used:
global { usage-count yes; } common { protocol C; } resource r0 { device /dev/drbd0; meta-disk internal;
on maisy { disk /dev/loop0; address 192.168.0.4:7788; } on hazy { disk /dev/loop0; address 192.168.0.5:7788; } }
(3) Create the drbd disk: drbdadm create-md r0 modprobe drbd drbdadm attach r0 drbdadm syncer r0 drbdadm connect r0 mkfs.ext3 /dev/drbd0
(4) Turned off drbd: /etc/init.d/drbd stop Stopped the drbd init script from running at startup (to avoid clashes with heartbeat): update-rc.d -f drbd remove
(5) Created /etc/ha.d/ha.cf, contents:
autojoin none mcast eth2 239.0.0.43 694 1 0 warntime 5 deadtime 15 initdead 60 keepalive 2 node maisy node hazy crm yes
(6) Created an appropriate /etc/ha.d/authkeys file.
(7) Set up resources and constraints:
cibadmin -o resources -C -x resources.xml cibadmin -o constraints -C -x constraints.xml
where these files contain: resources.xml:
<resources> <master_slave id="ms_drbd_files"> <meta_attributes id="ms_drbd_files-meta_attributes"> <attributes> <nvpair name="notify" value="yes" id="ms_drbd_files-meta_attributes-notify"/> <nvpair name="globally_unique" value="false" id="ms_drbd_files-meta_attributes-globally_unique"/> </attributes> </meta_attributes> <primitive id="drbd_files" class="ocf" provider="heartbeat" type="drbd"> <instance_attributes id="ms_drbd_files-instance_attributes"> <attributes> <nvpair name="drbd_resource" value="r0" id="ms_drbd_files-instance_attributes-drbd_resource"/> </attributes> </instance_attributes> <operations> <op id="ms_drbd_files-monitor-master" name="monitor" interval="29s" timeout="10s" role="Master"/> <op id="ms_drbd_files-monitor-slave" name="monitor" interval="30s" timeout="10s" role="Slave"/> </operations> </primitive> </master_slave> <group id="rg_files"> <primitive class="ocf" type="Filesystem" provider="heartbeat" id="mount_data"> <instance_attributes id="mount_data-instance_attributes"> <attributes> <nvpair name="device" value="/dev/drbd0" id="mount_data-device"/> <nvpair name="directory" value="/mnt" id="mount_data-directory"/> <nvpair name="fstype" value="ext3" id="mount_data-fstype"/> </attributes> </instance_attributes> </primitive> </group> </resources>
constraints.xml:
<constraints> <rsc_order id="files_after_drbd" from="rg_files" action="start" to="ms_drbd_files" to_action="promote" type="after"/> <rsc_colocation id="files_on_drbd" to="ms_drbd_files" to_role="master" from="rg_files" score="infinity"/> </constraints>
(8) Started heartbeat: /etc/init.d/heartbeat start
(9) Observed the following failure in the system logs:
May 4 15:09:11 maisy lrmd: [4150]: info: RA output: (drbd_files:0:start:stdout) May 4 15:09:11 maisy drbd[4491]: [4549]: DEBUG: r0 start: Module loaded. May 4 15:09:11 maisy drbd[4491]: [4551]: DEBUG: r0: Calling drbdadm -c /etc/drbd.conf state r0 May 4 15:09:11 maisy lrmd: [4150]: info: RA output: (drbd_files:0:start:stderr) local: 586: state': bad variable name May 4 15:09:11 maisy drbd[4491]: [4558]: ERROR: r0: Called drbdadm -c /etc/drbd.conf state r0 May 4 15:09:11 maisy drbd[4491]: [4559]: ERROR: r0: Exit code 2
(10) Modified /usr/lib/ocf/resource.d/heartbeat/drbd to use "role" rather than "state".
(11) Restarted heartbeat: /etc/init.d/heartbeat restart
(12) Observed that there is no longer such an error in the system logs:
May 4 15:28:06 maisy drbd[6359]: [6370]: DEBUG: r0: Calling drbdadm -c /etc/drbd.conf role r0 May 4 15:28:06 maisy drbd[6359]: [6377]: DEBUG: r0: Exit code 0 May 4 15:28:06 maisy drbd[6359]: [6378]: DEBUG: r0: Command output: Secondary/Unknown
OK, here is a recipe to see this problem. I hope all the
steps are here!
(0) Install drbd8-utils and heartbeat.
(1) Create a fake disk
dd if=/dev/zero of=drbd_disk count=1M bs=1
losetup /dev/loop0 ./drbd_disk
(2) Create /etc/drbd.conf. I used:
global {
usage-count yes;
}
common {
protocol C;
}
resource r0 {
device /dev/drbd0;
meta-disk internal;
on maisy {
disk /dev/loop0;
address 192.168.0.4:7788;
}
on hazy {
disk /dev/loop0;
address 192.168.0.5:7788;
}
}
(3) Create the drbd disk:
drbdadm create-md r0
modprobe drbd
drbdadm attach r0
drbdadm syncer r0
drbdadm connect r0
mkfs.ext3 /dev/drbd0
(4) Turned off drbd: /etc/init.d/drbd stop
Stopped the drbd init script from running at startup (to avoid clashes
with heartbeat):
update-rc.d -f drbd remove
(5) Created /etc/ha.d/ha.cf, contents:
autojoin none
mcast eth2 239.0.0.43 694 1 0
warntime 5
deadtime 15
initdead 60
keepalive 2
node maisy
node hazy
crm yes
(6) Created an appropriate /etc/ha.d/authkeys file.
(7) Set up resources and constraints:
cibadmin -o resources -C -x resources.xml
cibadmin -o constraints -C -x constraints.xml
where these files contain:
resources.xml:
<resources> attributes id="ms_ drbd_files- meta_attributes "> drbd_files- meta_attributes -notify" /> unique" value="false" id="ms_ drbd_files- meta_attributes -globally_ unique" /> attributes> "heartbeat" type="drbd"> instance_ attributes id="ms_ drbd_files- instance_ attributes" >
<attributes> resource" value="r0" id="ms_ drbd_files- instance_ attributes- drbd_resource" />
</attributes> /instance_ attributes> drbd_files- monitor- master" name="monitor" interval="29s" timeout="10s" role="Master"/> drbd_files- monitor- slave" name="monitor" interval="30s" timeout="10s" role="Slave"/> "heartbeat" id="mount_data"> instance_ attributes id="mount_ data-instance_ attributes" >
<attributes> data-device" /> data-directory" /> data-fstype" />
</attributes> /instance_ attributes>
<master_slave id="ms_drbd_files">
<meta_
<attributes>
<nvpair name="notify" value="yes" id="ms_
<nvpair name="globally_
</attributes>
</meta_
<primitive id="drbd_files" class="ocf" provider=
<
<nvpair name="drbd_
<
<operations>
<op id="ms_
<op id="ms_
</operations>
</primitive>
</master_slave>
<group id="rg_files">
<primitive class="ocf" type="Filesystem" provider=
<
<nvpair name="device" value="/dev/drbd0" id="mount_
<nvpair name="directory" value="/mnt" id="mount_
<nvpair name="fstype" value="ext3" id="mount_
<
</primitive>
</group>
</resources>
constraints.xml:
<constraints> after_drbd" from="rg_files" action="start" to="ms_drbd_files" to_action="promote" type="after"/>
<rsc_order id="files_
<rsc_colocation id="files_on_drbd" to="ms_drbd_files" to_role="master" from="rg_files" score="infinity"/>
</constraints>
(8) Started heartbeat: /etc/init. d/heartbeat start
(9) Observed the following failure in the system logs:
May 4 15:09:11 maisy lrmd: [4150]: info: RA output: (drbd_files: 0:start: stdout) 0:start: stderr) local: 586: state': bad variable name
May 4 15:09:11 maisy drbd[4491]: [4549]: DEBUG: r0 start: Module loaded.
May 4 15:09:11 maisy drbd[4491]: [4551]: DEBUG: r0: Calling drbdadm -c /etc/drbd.conf state r0
May 4 15:09:11 maisy lrmd: [4150]: info: RA output: (drbd_files:
May 4 15:09:11 maisy drbd[4491]: [4558]: ERROR: r0: Called drbdadm -c /etc/drbd.conf state r0
May 4 15:09:11 maisy drbd[4491]: [4559]: ERROR: r0: Exit code 2
(10) Modified /usr/lib/ ocf/resource. d/heartbeat/ drbd to use "role" rather than "state".
(11) Restarted heartbeat: /etc/init. d/heartbeat restart
(12) Observed that there is no longer such an error in the system logs:
May 4 15:28:06 maisy drbd[6359]: [6370]: DEBUG: r0: Calling drbdadm -c /etc/drbd.conf role r0
May 4 15:28:06 maisy drbd[6359]: [6377]: DEBUG: r0: Exit code 0
May 4 15:28:06 maisy drbd[6359]: [6378]: DEBUG: r0: Command output: Secondary/Unknown