![PacemakerDRBD 安装问题](https://linux22.com/image/607110/PacemakerDRBD%20%E5%AE%89%E8%A3%85%E9%97%AE%E9%A2%98.png)
我们在尝试让起搏器与 DRBD 一起工作时遇到困难,并且尝试了各种替代方法后仍无法让我们的“drbd1”安装并出现一些错误。
注意:我们正尝试让 Pacemaker 与现有的加密 RAID1 LVM 设置一起工作 - 这是不可能实现的还是“完全是个坏主意”?我们想利用每个盒子上的本地 RAID 以及 DRBD/pacemaker 提供的 Internet RAID 和故障转移的潜在优势。我们正在使用 Debian Squeeze。根据各种说明,我们已禁用 DRBD 启动初始化 ( update-rc.d -f drbd remove
) 并将 LVM 过滤器设置为filter = [ "a|drbd.*|", "r|.*|" ]
。
仅供参考 - 我们已经在 fstab 中注释掉了 LVM 挂载“/dev/vg2/vserverLV”,并且似乎始终需要这样做以避免启动错误。
我们认为 DRBD 可以正常工作,直到我们添加 Pacemaker 步骤(即启动时安装“dev/drbd1”;我们可以将相关数据从 server1 移到 server2,然后再移回,但需要使用命令行来完成此操作)。我们在网上看到各种说法,表明在 drbd.conf 中使用“mapper”选项是可行的。此外,如果我们首先配置 Pacemaker 进行简单的 IP 故障转移,那么它可以正常工作(即没有错误,我们可以通过故障转移地址进行 ping 操作),但当我们添加 DRBD 原语和相关语句时,它会停止工作。我们怀疑(除了可能“您无法使用现有 RAID 执行此操作”)我们在 drbd.conf 中使用了错误的“磁盘”语句,尽管我们尝试了很多替代方案,这是我们在添加 Pacemaker 之前使用的相同 drbd.conf,并且它似乎在那时可以正常工作。
最后,虽然各种配置语句都引用了“vservers”,但除了自完成“crm”工作以来消失的几个文本文件之外,我们还没有尝试向 DRBD 设备添加任何数据。
任何帮助都值得感激!
配置/日志
A)drbd.conf
global { usage-count no; }
common { syncer { rate 100M; } }
resource r1 {
protocol C;
startup {
wfc-timeout 15;
degr-wfc-timeout 60;
}
device /dev/drbd1 minor 1;
disk /dev/vg2/vserverLV;
meta-disk internal;
on server1 {
address 192.168.1.129:7801;
disk /dev/vg2/vserverLV;
}
on server2 {
address 192.168.1.128:7801;
disk /dev/vg2/vserverLV;
}
net {
cram-hmac-alg sha1;
shared-secret "secret";
after-sb-0pri discard-younger-primary; #discard-zero-changes;
after-sb-1pri discard-secondary;
after-sb-2pri call-pri-lost-after-sb;
}
}
B)起搏器配置
crm configure show
node server1
node server2
primitive app_ip ocf:heartbeat:IPaddr \
params ip="192.168.1.152" \
op monitor interval="30s"
primitive drbd ocf:linbit:drbd \
params drbd_resource="r1" \
op start interval="0" timeout="240" \
op stop interval="0" timeout="100" \
op monitor interval="59s" role="Master" timeout="30s" \
op monitor interval="60s" role="Slave" timeout="30s"
primitive fs_vservers ocf:heartbeat:Filesystem \
params device="/dev/drbd1" directory="/vservers" fstype="ext4" \
op start interval="0" timeout="60" \
op stop interval="0" timeout="120"
primitive vg2 ocf:heartbeat:LVM \
params volgrpname="vg2" exclusive="true" \
op start interval="0" timeout="30" \
op stop interval="0" timeout="30"
group lvm app_ip vg2 fs_vservers
ms ms_drbd drbd \
meta master-node-max="1" clone-max="2" clone-node-max="1" globally-unique="false" notify="true" target-role="Master"
location drbd_on_node1 ms_drbd \
rule $id="drbd_on_node1-rule" $role="master" 100: #uname eq server1
colocation vserver-deps inf: ms_drbd:Master lvm
order app_on_drbd inf: ms_drbd:promote lvm:start
property $id="cib-bootstrap-options" \
dc-version="1.0.9-74392a28b7f31d7ddc86689598bd23114f58978b" \
cluster-infrastructure="openais" \
expected-quorum-votes="2" \
stonith-enabled="false" \
no-quorum-policy="ignore"
C)crm 结果(有错误)
Last updated: Wed Feb 27 19:05:57 2013
Stack: openais
Current DC: server1 - partition with quorum
Version: 1.0.9-74392a28b7f31d7ddc86689598bd23114f58978b
2 Nodes configured, 2 expected votes
2 Resources configured.
============
Online: [ server2 server1 ]
Migration summary:
* Node server2:
drbd:1: migration-threshold=1000000 fail-count=1000000
* Node server1:
drbd:0: migration-threshold=1000000 fail-count=1000000
Failed actions:
drbd:1_start_0 (node=server2, call=8, rc=-2, status=Timed Out): unknown exec error
drbd:0_start_0 (node=server1, call=6, rc=-2, status=Timed Out): unknown exec error
D)挂载(没有“dev/drbd1”)。
/dev/mapper/vg1-root on / type ext4 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
/dev/md0 on /boot type ext4 (rw)
/dev/mapper/vg1-home on /home type ext4 (rw)
/dev/mapper/vg1-tmp on /tmp type ext4 (rw)
/dev/mapper/vg1-usr on /usr type ext4 (rw)
/dev/mapper/vg1-var on /var type ext4 (rw)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
E)fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/mapper/vg1-root / ext4 errors=remount-ro 0 1
# /boot was on /dev/md0 during installation
UUID=25829c6c-164c-4a1e-9e84-6bab180e38f4 /boot ext4 defaults 0 2
/dev/mapper/vg1-home /home ext4 defaults 0 2
/dev/mapper/vg1-tmp /tmp ext4 defaults 0 2
/dev/mapper/vg1-usr /usr ext4 defaults 0 2
/dev/mapper/vg1-var /var ext4 defaults 0 2
#/dev/mapper/vg2-vserverLV /vservers ext4 defaults 0 2
/dev/mapper/vg1-swap none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/scd1 /media/cdrom1 udf,iso9660 user,noauto 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0
F)fdisk -l
仅供参考,在我们的加密、RAID、LVM 中,md0 是 RAID 启动,md1 已加密并包含“vg1”中的操作系统,其中包含 /、home、swap、use、var 和 tmp 的逻辑卷。md1 已加密并包含“vg2”,我们从一个逻辑卷“vserversLV”和挂载点“vservers”开始。
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007c7a2
Device Boot Start End Blocks Id System
/dev/sda1 * 1 61 487424 fd Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sda2 61 1885 14648320 fd Linux raid autodetect
/dev/sda3 1885 3101 9765888 fd Linux raid autodetect
Disk /dev/sdb: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0008843c
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 61 487424 fd Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sdb2 61 1885 14648320 fd Linux raid autodetect
/dev/sdb3 1885 3101 9765888 fd Linux raid autodetect
Disk /dev/md0: 499 MB, 499109888 bytes
2 heads, 4 sectors/track, 121853 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/md1: 15.0 GB, 14998757376 bytes
2 heads, 4 sectors/track, 3661806 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x08040000
Disk /dev/md2: 9999 MB, 9999147008 bytes
2 heads, 4 sectors/track, 2441198 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x08040000
Disk /dev/dm-0: 15.0 GB, 14997704704 bytes
255 heads, 63 sectors/track, 1823 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/dm-1: 3997 MB, 3997171712 bytes
255 heads, 63 sectors/track, 485 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/dm-2: 1996 MB, 1996488704 bytes
255 heads, 63 sectors/track, 242 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/dm-3: 1996 MB, 1996488704 bytes
255 heads, 63 sectors/track, 242 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/dm-4: 3997 MB, 3997171712 bytes
255 heads, 63 sectors/track, 485 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/dm-5: 1996 MB, 1996488704 bytes
255 heads, 63 sectors/track, 242 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/dm-6: 499 MB, 499122176 bytes
255 heads, 63 sectors/track, 60 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/dm-7: 9998 MB, 9998094336 bytes
255 heads, 63 sectors/track, 1215 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
G)系统日志摘录
Feb 27 06:36:22 server1 lrmd: [1705]: info: RA output: (p_drbd_r1:0:start:stderr) Command '
Feb 27 06:36:22 server1 lrmd: [1705]: info: RA output: (p_drbd_r1:0:start:stderr) drbdsetup
Feb 27 06:36:22 server1 lrmd: [1705]: info: RA output: (p_drbd_r1:0:start:stderr)
Feb 27 06:36:22 server1 lrmd: [1705]: info: RA output: (p_drbd_r1:0:start:stderr) 1
Feb 27 06:36:22 server1 lrmd: [1705]: info: RA output: (p_drbd_r1:0:start:stderr)
Feb 27 06:36:22 server1 lrmd: [1705]: info: RA output: (p_drbd_r1:0:start:stderr) disk
Feb 27 06:36:22 server1 lrmd: [1705]: info: RA output: (p_drbd_r1:0:start:stderr)
Feb 27 06:36:22 server1 lrmd: [1705]: info: RA output: (p_drbd_r1:0:start:stderr) /dev/vg2/vserverLV
Feb 27 06:36:22 server1 lrmd: [1705]: info: RA output: (p_drbd_r1:0:start:stderr)
Feb 27 06:36:22 server1 lrmd: [1705]: info: RA output: (p_drbd_r1:0:start:stderr) /dev/vg2/vserverLV
Feb 27 06:36:22 server1 lrmd: [1705]: info: RA output: (p_drbd_r1:0:start:stderr)
Feb 27 06:36:22 server1 lrmd: [1705]: info: RA output: (p_drbd_r1:0:start:stderr) internal
Feb 27 06:36:22 server1 lrmd: [1705]: info: RA output: (p_drbd_r1:0:start:stderr)
Feb 27 06:36:22 server1 lrmd: [1705]: info: RA output: (p_drbd_r1:0:start:stderr) --set-defaults
Feb 27 06:36:22 server1 lrmd: [1705]: info: RA output: (p_drbd_r1:0:start:stderr)
Feb 27 06:36:22 server1 lrmd: [1705]: info: RA output: (p_drbd_r1:0:start:stderr) --create-device
Feb 27 06:36:22 server1 lrmd: [1705]: info: RA output: (p_drbd_r1:0:start:stderr) ' terminated with exit code 20
Feb 27 06:36:22 server1 lrmd: [1705]: info: RA output: (p_drbd_r1:0:start:stderr) drbdadm attach r1: exited with code 20
Feb 27 06:36:22 server1 drbd[2329]: ERROR: r1: Called drbdadm -c /etc/drbd.conf --peer server2 up r1
Feb 27 06:36:22 server1 drbd[2329]: ERROR: r1: Exit code 1
Feb 27 06:36:22 server1 drbd[2329]: ERROR: r1: Command output:
Feb 27 06:36:22 server1 lrmd: [1705]: info: RA output: (p_drbd_r1:0:start:stdout)
Feb 27 06:36:22 server1 lrmd: [1705]: info: RA output: (p_drbd_r1:0:start:stderr) Can not open device '/dev/vg2/vserverLV': No such file or directory
Feb 27 06:36:22 server1 lrmd: [1705]: info: RA output: (p_drbd_r1:0:start:stderr) Command 'drbdsetup 1 disk /dev/vg2/vserverLV
Feb 27 06:36:22 server1 lrmd: [1705]: info: RA output: (p_drbd_r1:0:start:stderr) /dev/vg2/vserverLV internal --set-defaults --create-device' terminated with exit code 20#012drbdadm attach r1: exited with code 20
Feb 27 06:36:22 server1 drbd[2329]: ERROR: r1: Called drbdadm -c /etc/drbd.conf --peer server2 up r1
Feb 27 06:36:22 server1 drbd[2329]: ERROR: r1: Exit code 1
Feb 27 06:36:22 server1 drbd[2329]: ERROR: r1: Command output:
Feb 27 06:36:22 server1 lrmd: [1705]: info: RA output: (p_drbd_r1:0:start:stdout)
Feb 27 06:36:23 server1 lrmd: [1705]: info: RA output: (p_drbd_r1:0:start:stderr) Can not open device '/dev/vg2/vserverLV': No such file or directory
答案1
看起来您可能正在遵循有关如何使用 DRBD 作为 LVM 的物理磁盘的指南或说明。但是,您尝试做的是使用 LVM 作为 DRBD 的备份磁盘。为此,不需要额外的配置或特殊的 LVM 过滤器。只需在 drbd 配置中将逻辑卷指定为备份磁盘即可。请参阅:http://www.drbd.org/users-guide/s-lvm-lv-as-drbd-backing-dev.html
RA 输出:(p_drbd_r1:0:start:stdout)2 月 27 日 06:36:23 server1 lrmd:[1705]:信息:RA 输出:(p_drbd_r1:0:start:stderr)无法打开设备“/dev/vg2/vserverLV”:没有此文件或目录
日志中的上述错误表明 DRBD 无法找到并附加到其备份磁盘。这很可能是因为您的 LVM 过滤器阻止此卷组在启动时被激活。
将 LVM 过滤器恢复为默认值,并删除'primitive vg2 ocf:heartbeat:LVM
(以及引用它的顺序和共置约束),因为 vg2 需要在 DRBD 启动之前激活。不是通过集群激活,也不是在 DRBD 之后激活。
至于使用加密卷作为 DRBD 的备份磁盘,只要在 DRBD 尝试连接到它之前将其解锁并处于活动状态,这实际上不是问题。这意味着要么在启动时提示输入密钥/密码,要么使用类似 crypttab 的东西自动执行此操作。重要的是要注意,此加密发生在 DRBD 下方,因此复制流量仍以明文形式发送。因此,如果复制流量也需要加密,您可能需要使用 vpn 进行复制流量。
您可以在日志中看到,它在有机会提升 DRBD 资源之前尝试挂载文件系统。这会失败,因为除非它是主设备,否则您无法访问 DRBD 设备。
一些排序和共置限制应该可以帮你解决问题。
crm(live)configure# colocation fs_with_drbd_master inf: fs_vservers ms_drbd:Master
crm(live)configure# order fs_after_drbd inf: ms_drbd:promote fs_vservers:start
此外,由于 DRBD 受 Pacemaker 控制,因此您不希望它在启动时启动。Pacemaker 将在停止时处理启动。所以,"update-rc.d -f drbd remove"
这就是您想要的。文件系统也是如此。由于文件系统现在由 Pacemaker 控制,因此不要将其包含在您的 fstab 中。