【问题标题】:Start at boot time Corosync 2.X + Pacemaker 1.1 cluster (Debian Wheezy)在引导时启动 Corosync 2.X + Pacemaker 1.1 集群 (Debian Wheezy)
【发布时间】:2015-08-20 14:31:32
【问题描述】:

我遇到了一个看起来很容易解决的问题,但我不知道解决它的正确方法。

我已经在谷歌上搜索了将近一周的解决方案,但没有运气。 (我只找到了this,但没有清晰干净的解决方案)

我创建了一个双节点集群 NOT FOR PRODUCTION,在两个节点上都具有以下配置:

  • Debian Wheezy 7.7
  • Corosync v2.3.4
  • 起搏器 v1.1.12
  • Libqb v0.17.1
  • Cluster-glue v1.0.12
  • 资源代理 v3.9.6
  • crmsh v2.1.0

我已经从 this guide 的源代码安装了集群软件,以便在 Debian 上编译集群软件

在安装之前,我确保没有旧的 corosync 或起搏器依赖项。

安装后,我配置了我的集群,编辑文件(在两个节点上)corosync.conf 并创建和复制 authkey

# Please read the corosync.conf.5 manual page
totem {
        version: 2

#       crypto_cipher: none
#       crypto_hash: none
        secauth: off
        cluster_name: my-cluster
#       interface {
#               ringnumber: 0
#               bindnetaddr: 10.16.2.0
#               mcastport: 5405
#               ttl: 1
#       }
        transport: udpu
}

logging {
        fileline: off
        to_logfile: yes
        to_syslog: yes
        logfile: /var/log/cluster/corosync.log
        debug: off
        timestamp: on
        logger_subsys {
                subsys: QUORUM
                debug: off
        }
}

nodelist {
        node {
                ring0_addr: 10.16.2.50
                name: pc1
                nodeid: 1
        }

        node {
                ring0_addr: 10.16.2.51
                name: pc2
                nodeid: 2
        }
}

quorum {
        # Enable and configure quorum subsystem (default: off)
        # see also corosync.conf.5 and votequorum.5
        provider: corosync_votequorum
        two_node: 1
}

我已经在起搏器上配置了资源

node 1: pc-1
node 2: pc-2
primitive cluster-apache2 apache \
    params configfile="/etc/apache2/apache2.conf" httpd="/usr/sbin/apache2" port=80 \
    op monitor interval=10s timeout=60s \
    op start timeout=40s interval=0 \
    op stop timeout=60s interval=0
primitive cluster-ip IPaddr2 \
    params ip=10.16.2.240 cidr_netmask=24 \
    op monitor interval=10s timeout=20s \
    op start timeout=20s interval=0 \
    op stop timeout=20s interval=0
primitive cluster-tftp lsb:tftpd-hpa \
    op monitor interval=30 \
    op start interval=0 timeout=120s \
    op stop interval=0 timeout=120s
colocation my-cluster-dependency inf: cluster-ip cluster-apache2 cluster-tftp
property cib-bootstrap-options: \
    dc-version=1.1.12-561c4cf \
    cluster-infrastructure=corosync \
    stonith-enabled=false \
    cluster-name=my-cluster

在完成所有配置之后,我已经开始使用 corosync 和起搏器

/etc/init.d/corosync start
/etc/init.d/pacemaker/start

集群已启动并正在运行,但我找不到在启动时启动集群的方法

root@PC:~# crm_mon -1
Last updated: Fri Jun  5 18:05:06 2015
Last change: Mon Jun  1 18:51:57 2015 via cibadmin on pc-1
Stack: corosync
Current DC: pc-1 (1) - partition with quorum
Version: 1.1.12-561c4cf
2 Nodes configured
3 Resources configured


Online: [ pc-1 pc-2 ]

 cluster-ip (ocf::heartbeat:IPaddr2):   Started pc-1 
 cluster-apache2    (ocf::heartbeat:apache):    Started pc-1 
 cluster-tftp   (lsb:tftpd-hpa):    Started pc-1 

我已尝试将 init.d 脚本添加到运行级别,但我没有得到响应,并且对 corosync 没有影响

root@PC:~# update-rc.d corosync defaults 
update-rc.d: using dependency based boot sequencing

起搏器上的这个错误

root@PC:~# update-rc.d pacemaker defaults 
update-rc.d: using dependency based boot sequencing
insserv: Service corosync has to be enabled to start service pacemaker
insserv: exiting now!
update-rc.d: error: insserv rejected the script header

我已按照 clusterlabs 上的指南进行操作,但找不到 Debian 和 crmsh 的解决方案 (在the official guide 上,他们使用 pcs 而不是 crmsh,但即便如此,我也找不到正确的程序让集群在启动时运行)

我可以添加的另一个信息是,我还尝试使用 crmsh 启动和运行集群,试图找到一种方法让它在启动时运行。 如果我运行 crm 集群启动(而不是 init.d 脚本)corosync 和起搏器启动并且集群开始运行,但是如果我运行命令停止我得到这个错误

crm(live)# cluster stop
ERROR: cluster.stop: Failed to stop pacemaker service:

使集群在启动时运行的正确方法是什么? 必须启动和启用什么守护进程?

起搏器应该由 corosync 启动吗?我找到了this guide,但提到的参数 service-name 和 service-ver 在我的 corosync 配置中不起作用。

service {
    name: pacemaker
    ver: 0
}

希望有人能帮我解决这个问题

提前致谢

【问题讨论】:

    标签: debian cluster-computing pacemaker runlevel


    【解决方案1】:

    对于 2 个主动/被动节点,您应该禁用仲裁。

    crm configure property no-quorum-policy=ignore
    

    只要 corosync 服务处于活动状态,集群就会处于活动状态。您不需要明确启动起搏器。 你至少应该有关于 corosync 的这几行:

    ls -lR /etc/rc* | grep -E 'corosync|rc'
    /etc/rc0.d:
    lrwxrwxrwx 1 root root  18 may 15 17:19 K01corosync -> ../init.d/corosync
    /etc/rc1.d:
    lrwxrwxrwx 1 root root  18 may 15 17:19 K01corosync -> ../init.d/corosync
    /etc/rc2.d:
    lrwxrwxrwx 1 root root  18 may 15 17:19 S19corosync -> ../init.d/corosync
    lrwxrwxrwx 1 root root  18 dic 17  2013 S99rc.local -> ../init.d/rc.local
    /etc/rc3.d:
    lrwxrwxrwx 1 root root  18 may 15 17:19 S19corosync -> ../init.d/corosync
    lrwxrwxrwx 1 root root  18 dic 17  2013 S99rc.local -> ../init.d/rc.local
    /etc/rc4.d:
    lrwxrwxrwx 1 root root  18 may 15 17:19 S19corosync -> ../init.d/corosync
    lrwxrwxrwx 1 root root  18 dic 17  2013 S99rc.local -> ../init.d/rc.local
    /etc/rc5.d:
    lrwxrwxrwx 1 root root  18 may 15 17:19 S19corosync -> ../init.d/corosync
    lrwxrwxrwx 1 root root  18 dic 17  2013 S99rc.local -> ../init.d/rc.local
    /etc/rc6.d:
    lrwxrwxrwx 1 root root  18 may 15 17:19 K01corosync -> ../init.d/corosync
    /etc/rcS.d:
    

    如果您没有此链接或类似链接,则应手动创建。

    希望能解决你的问题

    【讨论】:

    • 我已禁用仲裁。现在我可以将 update-rc.d 与 corosync 和起搏器一起使用(在 init.d 脚本中没有指定默认运行级别),但是起搏器没有启动。我用的是pacemaker 1.1.12,corosync不能自动启动...你用的是哪个版本?
    • 我有 corosync 和 alos 起搏器的符号链接
    猜你喜欢
    • 2016-06-06
    • 1970-01-01
    • 2021-08-29
    • 1970-01-01
    • 2015-01-25
    • 1970-01-01
    • 1970-01-01
    • 2020-04-09
    • 1970-01-01
    相关资源
    最近更新 更多