我是 Pacemaker 和 DRBD 的新手,但我必须一起配置它们。我创建了 2 个 drbd 资源:Drbdwww 和 DrbdMysql,但是当我使用 drbd_mon 时出现以下错误:
Stack: corosync
Current DC: s-ha-web1 (version 1.1.15-e174ec8) - partition with quorum
Last updated: Mon May 8 21:58:45 2017 Last change: Mon May 8 21:58:36 2017 by hacluster via crmd on s-ha-web1
2 nodes and 7 resources configured
Online: [ s-ha-web1 s-ha-web2 ]
Resource Group: haweb
vip (ocf::heartbeat:IPaddr2): Started s-ha-web1
httpd (ocf::heartbeat:apache): Started s-ha-web1
Drbdwww (ocf::linbit:drbd): FAILED (blocked)[ s-ha-web1 s-ha-web2 ]
fsDrbdwww (ocf::heartbeat:Filesystem): Stopped
DrbdMysql (ocf::linbit:drbd): FAILED (blocked)[ s-ha-web1 s-ha-web2 ]
fsDrbdMysql (ocf::heartbeat:Filesystem): Stopped
mysql (ocf::heartbeat:mysql): Stopped
Failed Actions:
* Drbdwww_monitor_0 on s-ha-web1 'not configured' (6): call=14, status=complete, exitreason='none',
last-rc-change='Mon May 8 21:58:40 2017', queued=0ms, exec=21ms
* DrbdMysql_stop_0 on s-ha-web1 'not configured' (6): call=23, status=complete, exitreason='none',
last-rc-change='Mon May 8 21:58:40 2017', queued=0ms, exec=30ms
* Drbdwww_stop_0 on s-ha-web2 'not configured' (6): call=32, status=complete, exitreason='none',
last-rc-change='Mon May 8 21:58:40 2017', queued=0ms, exec=17ms
* DrbdMysql_stop_0 on s-ha-web2 'not configured' (6): call=31, status=complete, exitreason='none',
last-rc-change='Mon May 8 21:58:40 2017', queued=0ms, exec=17ms
这是我的起搏器配置:
crm configure property stonith-enabled=false
crm configure property no-quorum-policy=ignore
crm configure primitive vip ocf:heartbeat:IPaddr2 params ip=192.168.100.100 cidr_netmask=24 nic="eth1" op monitor interval="30s" timeout="20s"
crm configure primitive Drbdwww ocf:linbit:drbd params drbd_resource="rwww" op monitor interval="30s" role="Slave" op monitor interval="29s" role="Master"
crm configure primitive fsDrbdwww ocf:heartbeat:Filesystem params device="/dev/drbd0" directory="/var/www/html" fstype="ext4"
crm configure primitive DrbdMysql ocf:linbit:drbd params drbd_resource="rmysql" op monitor interval="30s" role="Slave" op monitor interval="29s" role="Master"
crm configure primitive fsDrbdMysql ocf:heartbeat:Filesystem params device="/dev/drbd1" directory="/var/lib/mysql_drbd" fstype="ext4"
有人能帮助我吗?如果您需要更多信息,请告诉我。
答案1
您在这里遗漏了不少内容。
首先,您需要为每个 DRBD 设备设置一个主从资源集。
然后,您可能希望创建资源组(fs、ip、服务),使用共置和排序约束来告诉这些组仅在其各自的 DRBD 设备提升为主设备时/之后启动。资源组意味着组内资源的共置和排序。
Google 应该会提供大量关于使用 DRBD 和 Pacemaker 设置 HA LAMP 堆栈的指南。
编辑:以答案的形式提供了更多信息...我现在可以获得更具体的信息。
您的 CIB(起搏器配置)应如下所示:
node 1: s-ha-web1
node 2: s-ha-web2
primitive Drbdwww ocf:linbit:drbd \
params drbd_resource="rwww" \
op monitor interval="30s" role="Slave" \
op monitor interval="29s" role="Master"
primitive DrbdMysql ocf:linbit:drbd \
params drbd_resource="rmysql" \
op monitor interval="30s" role="Slave" \
op monitor interval="29s" role="Master"
primitive fsDrbdwww ocf:heartbeat:Filesystem \
params device="/dev/drbd0" directory="/var/www/html" fstype="ext4" \
op monitor interval=30s timeout=30s
primitive fsDrbdMysql ocf:heartbeat:Filesystem \
params device="/dev/drbd1" directory="/var/lib/mysql_drbd" fstype="ext4" \
op monitor interval=30s timeout=30s
primitive vipwww ocf:heartbeat:IPaddr2 \
params ip=192.168.100.100 cidr_netmask=24 nic="eth1" \
op monitor interval="30s" timeout="20s"
primitive vipmysql ocf:heartbeat:IPaddr2 \
params ip=192.168.100.101 cidr_netmask=24 nic="eth1" \
op monitor interval="30s" timeout="20s"
primitive httpd ocf:heartbeat:apache \
op start interval=0s timeout=40s
op stop interval=0s timeout=60s
op monitor interval=20s timeout=20s
primitive mysql ocf:heartbeat:mysql \
op start interval=0s timeout=120s
op stop interval=0s timeout=120s
op monitor interval=20s timeout=30s
group gwww fsDrbdwww vipwww httpd
group gmysql fsDrbdMysql vipmysql mysql
order o_drbdwww-before-gwww inf: ms_drbdwww:promote gwww:start
colocation cl_gwww-with-drbdwww inf: gwww ms_drbdwww:Master
order o_drbdMysql-before-gmysql inf: ms_drbdMysql:promote gmysql:start
colocation cl_gmysql-with-drbdMysql inf: gmysql ms_drbdMysql:Master
ms ms_drbdwww Drbdwww \
meta master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 notify=true
ms ms_drbdMysql DrbdMysql \
meta master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 notify=true
property cib-bootstrap-options: \
stonith-enabled=false \
no-quorum-policy=ignore
DRBD 资源上的操作失败可能意味着您没有正确设置 DRBD 设备。您是否已经为设备创建了元数据?如果是,您是否已经强制将一个节点提升为主节点以启动初始同步?输出是什么样的cat /proc/drbd
?
答案2
谢谢您的回答。我创建了一个名为 haweb 的组,其 vip 为 Drbdwww DrbdMysql fsDrbdwww fsDrbdMysql apache2 mysql,但当我想创建主从资源时,出现了错误,因为 Drbdwww 和 DrbdMysql 是 haweb 组的子组。我删除了 haweb 组,并使用
ms ms_drbdMysql DrbdMysql \
meta master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 notify=true
ms ms_drbdwww Drbdwww \
meta master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 notify=true
但我仍然失败了(被阻止):
Master/Slave Set: ms_drbdwww [Drbdwww]
Drbdwww (ocf::linbit:drbd): FAILED s-ha-web2 (blocked)
Master/Slave Set: ms_drbdMysql [DrbdMysql]
DrbdMysql (ocf::linbit:drbd): FAILED s-ha-web2 (blocked)
* fsDrbdwww_start_0 on s-ha-web1 'unknown error' (1): call=14, status=complete, exitreason='Couldn't mount filesystem /dev/drbd0 on /var/www/html',
last-rc-change='Mon May 8 23:24:04 2017', queued=0ms, exec=17ms
* fsDrbdMysql_start_0 on s-ha-web1 'unknown error' (1): call=21, status=complete, exitreason='Couldn't mount filesystem /dev/drbd1 on /var/lib/mysql_drbd',
last-rc-change='Mon May 8 23:24:04 2017', queued=0ms, exec=17ms
现在我在服务器 1 上有一些资源,在服务器 2 上也有一些资源 :( 我会搜索更多有关主机托管和群组的信息!谢谢
编辑:我不知道如何创建我的组和主机托管我是否必须创建 2 个 VIP?1 个用于 apache + DRBD-WWW,1 个用于 mysql 和 DRBD-mysql?