我在 sles12 上创建了一个 2 节点集群。以下是配置 -
msnode1:~ # crm --version
crm 3.0.0
msnode1:~ # corosync -v
Corosync Cluster Engine, version '2.3.6'
Copyright (c) 2006-2009 Red Hat, Inc.
msnode1:~ # crm config show
node 1: msnode1
node 2: msnode2
primitive mspersonal systemd:mspersonal \
op monitor interval=30s
primitive virtip IPaddr \
params ip=10.243.109.103 cidr_netmask=21 \
op monitor interval=30s
location cli-prefer-virtip virtip role=Started inf: msnode1
colocation msconstraint inf: virtip mspersonal
order msorder Mandatory: virtip mspersonal
property cib-bootstrap-options: \
have-watchdog=false \
dc-version=1.1.16-4.8-77ea74d \
cluster-infrastructure=corosync \
cluster-name=mscluster \
stonith-enabled=false \
placement-strategy=balanced \
help \
list \
last-lrm-refresh=1561341732
rsc_defaults rsc-options: \
resource-stickiness=100 \
migration-threshold=2
op_defaults op-options: \
timeout=600 \
record-pending=true
msnode1:~ # crm status
Stack: corosync
Current DC: msnode1 (version 1.1.16-4.8-77ea74d) - partition with quorum
Last updated: Tue Jun 25 17:43:44 2019
Last change: Tue Jun 25 17:38:21 2019 by hacluster via cibadmin on msnode1
2 nodes configured
2 resources configured
Online: [ msnode1 msnode2 ]
Full list of resources:
virtip (ocf::heartbeat:IPaddr): Started msnode1
mspersonal (systemd:mspersonal): Started msnode1
当我关闭节点 1 上的集群(或重新启动节点 1)时,资源在 msnode2 上启动,但随后它们立即关闭,情况发生变化:
msnode1:~ # systemctl stop pacemaker
msnode2:~ # crm status
Stack: corosync
Current DC: msnode2 (version 1.1.16-4.8-77ea74d) - partition WITHOUT quorum
Last updated: Tue Jun 25 17:44:26 2019
Last change: Tue Jun 25 17:38:20 2019 by hacluster via cibadmin on msnode1
2 nodes configured
2 resources configured
Online: [ msnode2 ]
OFFLINE: [ msnode1 ]
Full list of resources:
virtip (ocf::heartbeat:IPaddr): Stopped
mspersonal (systemd:mspersonal): Stopped
当我在 msnode1 上重新启动起搏器服务时,资源会重新在 msnode1 上启动 --
msnode1:~ # systemctl start pacemaker
msnode1:~ # crm status
Stack: corosync
Current DC: msnode2 (version 1.1.16-4.8-77ea74d) - partition with quorum
Last updated: Tue Jun 25 17:46:09 2019
Last change: Tue Jun 25 17:38:20 2019 by hacluster via cibadmin on msnode1
2 nodes configured
2 resources configured
Online: [ msnode1 msnode2 ]
Full list of resources:
virtip (ocf::heartbeat:IPaddr): Started msnode1
mspersonal (systemd:mspersonal): Started msnode1
但是当我重做相同的练习时,资源实际上在 msnode2 上启动 -
msnode1:~ # systemctl stop pacemaker
msnode2:~ # crm status
Stack: corosync
Current DC: msnode2 (version 1.1.16-4.8-77ea74d) - partition WITHOUT quorum
Last updated: Tue Jun 25 17:47:00 2019
Last change: Tue Jun 25 17:38:20 2019 by hacluster via cibadmin on msnode1
2 nodes configured
2 resources configured
Online: [ msnode2 ]
OFFLINE: [ msnode1 ]
Full list of resources:
virtip (ocf::heartbeat:IPaddr): Started msnode2
mspersonal (systemd:mspersonal): Started msnode2
但是,当我在 msnode1 上再次启动pacemaker时,资源会移回 msnode1,这是我没想到的,因为粘性设置为 100。
我无法发现此集群配置中缺少的内容。
答案1
我无法说出为什么第一次尝试在没有日志或更多信息的情况下资源完全停止。考虑到下面的位置限制,第二个练习的表现符合我的预期。
location cli-prefer-virtip virtip role=Started inf: msnode1
这个位置约束有一个无穷大的分数,它将远远超过你的粘性分数 200。如果你要删除这个位置约束并再次尝试测试,我怀疑它会以期望的方式表现。