我正在 CentOS 8 上使用 Pacemaker 和 corosync 设置 3 节点 DRBD 集群。
我设置了 3 个 IP 资源、1 个 apache webserver 资源,现在我想要设置我的 drbd 资源。
如果 Drbd 单独使用 systemctl 启动并且正常工作,则表示 Drbd 正在运行。
但是如果我使用以下命令创建资源:
pcs resource create DRBD-1 ocf:linbit:drbd drbd_resource=drbd1 op monitor interval=1m role=Master op monitor interval=59s role=Slave
它永远不会启动并保持停止状态。
起搏器日志显示Could not onnect to 'drbd' generic netlink family
:<1> error creating netling socket
/var/log/messages 说:
ERROR: drbd2: Called drbdadm -c /etc/drbd.conf down drbd2
ERROR: drbd2: Exit code 20
ERROR: drbd2: Command output:
ERROR: drbd2: Called /usr/sbin/crm_master -l reboot -D
ERROR: drbd2: Exit code 102
ERROR: drbd2: Command output:
notice: DRBD-2_stop_0:7360:stderr [ <1>error creating netlink socket ]
Error connecting to the CIB manager: Transport endpoint is not connected
我不确定 /var/log/messages 中的这一行
notice: DRBD-2_stop_0:7360:stderr [ /usr/lib/ocf/lib/heartbeat/ocf-shellfuncs: line 235: /var/log/pacemaker/pacemaker.log: Permission denied ]
编辑1 如果我为 DRBD 创建主从资源,我将从起搏器收到以下消息:
Starting resources on a cluster is (almost) always done by pacemaker and
not directly from pcs. If your resource isn't starting, it's usually
due to either a misconfiguration of the resource (which you debug in
the system log), or constraints preventing the resource from starting or
the resource being disabled. You can use 'pcs resource debug-start' to
test resource configuration, but it should *not* normally be used to start
resources in a cluster.
答案1
pcs 命令在版本中有所更改0.10
,请尝试以下操作:
# disable selinux is needed
pcs resource create DRBD-1 ocf:linbit:drbd drbd_resource=drbd1 op monitor interval=1m role=Master op monitor interval=59s role=Slave
pcs resource promotable DRBD-1 master-max=1 master-node-max=1 clone-max=3 clone-node-max=1 notify=true
答案2
DRBD 必须在 Pacemaker 中配置为多状态克隆,因为它可以在多种状态(主或辅助)下启动。
除了您定义的原语之外,您还需要定义多状态克隆,如下所示:
pcs resource create DRBD-1 ocf:linbit:drbd drbd_resource=drbd1 op monitor interval=1m role=Master op monitor interval=59s role=Slave
pcs resource master ms-DRBD-1 DRBD-1 master-max=1 master-node-max=1 clone-max=3 clone-node-max=1 notify=true
接下来的部分,关于,听起来可能与 SELinux 有关。请检查您的 中Permission Denied
是否有条目,如果有,请尝试将 SELinux 设置为 permissive,看看是否允许 Pacemaker 管理 DRBD:DENIED
/var/log/audit/audit.log
setenforce 0