如何在 Linux 集群上设置虚拟 IP?

如何在 Linux 集群上设置虚拟 IP?

我在设置虚拟 IP 和 Linux (Ubuntu) 集群时遇到了一些问题,希望有人能帮忙。这是我尝试设置的第一个节点集群,我找不到很多关于这个问题的资源。

我将按照本指南在 Ubuntu 上设置 DRBD/虚拟 IP:https://wiki.edubuntu.org/ClusterStack/Natty#HA_Virtual_IP_Address

但我在设置虚拟 IP 时遇到了一些重大问题。我已经设置了 DRBD,它同步和加载没有任何问题。但当我尝试添加虚拟 IP 时,我收到以下错误消息

pengine: [843]: info: native_color: Resource virtual_ip cannot run anywhere

这是我的 CRM 配置:

node EOA-MAIL-IB-1
node EOA-MAIL-IB-2
primitive drbd_eoa ocf:linbit:drbd \
    params drbd_resource="eoa-ib" \
    op monitor interval="15s"
primitive fs_drbd ocf:heartbeat:Filesystem \
    params device="/dev/drbd0" directory="/mnt" fstype="ext4" \
    meta target-role="Stopped"
primitive virtual_ip ocf:heartbeat:IPaddr2 \
    params ip="192.168.1.254" nic="eth1" \
    op monitor interval="30s"
group res_group fs_drbd virtual_ip
ms ms_drbd drbd_eoa \
    meta master-max="1" master-node-max="1" clone-max="2" clone-node-max="1$
colocation mnt_on_master inf: res_group ms_drbd:Master
order mount_after_drbd inf: ms_drbd:promote res_group:start
property $id="cib-bootstrap-options" \
    dc-version="1.0.8-042548a451fce8400660f6031f4da6f0223dd5dd" \
    cluster-infrastructure="openais" \
    expected-quorum-votes="2" \
    stonith-enabled="false" \
    no-quorum-policy="ignore" \
    last-lrm-refresh="1336683121"

以下是“crm resource list”的输出:

Master/Slave Set: ms_drbd
 Masters: [ EOA-MAIL-IB-1 ]
 Slaves: [ EOA-MAIL-IB-2 ]
Resource Group: res_group
 fs_drbd    (ocf::heartbeat:Filesystem) Stopped
 virtual_ip (ocf::heartbeat:IPaddr2) Stopped

我在两台服务器上安装了两个 NICS。

任何帮助将不胜感激。

谢谢!

答案1

事实证明 CRM 配置文件存在配置问题,请找出原因。:)

以下是更新/正确的配置文件,适用于遇到此类问题的其他用户:

node EOA-MAIL-IB-1
node EOA-MAIL-IB-2
primitive drbd_eoa ocf:linbit:drbd \
    params drbd_resource="eoa-ib" \
    op monitor interval="120s" \
op start interval="0" timeout="240s" \
op stop interval="0" timeout="100s"

primitive fs_drbd ocf:heartbeat:Filesystem \
    params device="/dev/drbd0" directory="/mnt/eoacluster" fstype="ext4" \
    op start interval="0" timeout="60s" \
op stop interval="0" timeout="60s"

primitive mysql_eoa ocf:heartbeat:mysql \
    params config="/etc/mysql/my.cnf" datadir="/mnt/eoacluster/mysql" \
binary="/usr/bin/mysqld_safe" pid="/var/run/mysql/mysql.pid" \
socket="/var/run/mysql/mysql.sock" log="/var/log/mysql/mysql.log" \
additional_parameters="--bind-address=192.168.1.254" \
    op start interval="0" timeout="120s" \
    op stop interval="0" timeout="120s" \
    op monitor interval="15s" user="mysql" group="mysql"

primitive virtual_ip ocf:heartbeat:IPaddr2 \
    params ip="192.168.1.254" nic="eth1" \
    op monitor interval="10s" \
meta is-managed="true"

group res_group virtual_ip fs_drbd mysql_eoa \
meta target-role="Started"

ms ms_drbd drbd_eoa \
    meta master-max="1" master-node-max="1" \
clone-max="2" clone-node-max="1" notify="true" \
target-role="Started"

location master-prefer-EOA-MAIL-IB-1 virtual_ip 25: EOA-MAIL-IB-1

colocation res_group_on_drbd_eoa inf: res_group ms_drbd:Master

order res_group_after_ms_drbd inf: ms_drbd:promote res_group:start

property $id="cib-bootstrap-options" \
    dc-version="1.0.8-042548a451fce8400660f6031f4da6f0223dd5dd" \
    cluster-infrastructure="openais" \
    expected-quorum-votes="2" \
    stonith-enabled="false" \
    no-quorum-policy="ignore" \
    last-lrm-refresh="1336683121"

相关内容