Danilo7
Danilo7

Reputation: 47

Start at boot time Corosync 2.X + Pacemaker 1.1 cluster (Debian Wheezy)

I am having what seems an easy problem to solve, but I don't know the correct way to solve it.

I've been googling for a solution for almost a week without luck. (All I found was this but had no clear and clean solution)

I have created a two node cluster NOT FOR PRODUCTION with the following configuration on both nodes:

I've installed the cluster software from source following this guide to compile cluster softwares on Debian

Before installing I made sure there were no older corosync or pacemaker dependencies.

After the installation I configured my cluster editing the file (on both nodes) corosync.conf and creating and copying the 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
}

I've configured the resources on pacemaker

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

After all the configuratins I've started both corosync and pacemaker with

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

The cluster is up and running, but I can't find a way to start the cluster at boot time

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 

I've tried adding the init.d scripts to runlevels, but I get no response and no effect on corosync

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

and this error on pacemaker

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

I've followed the guide on clusterlabs but I can't find a solution for Debian and crmsh (on the official guide they use pcs instead of crmsh, but even with that I could not find the correct procedure to make the cluster run at boot time)

Another info I can add is, I've also tried to use crmsh to start and run the cluster, trying to find a way to make it run at boot time. If i run crm cluster start (instead of the init.d scripts) corosync and pacemaker start and the cluster starts running, but if i run the command to stop I get this error

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

What is the correct way to make the cluster run at boot time? What daemon must be started and enabled?

Should pacemaker be started by corosync? I've found this guide but the parameters mentioned service-name and service-ver don't work in my corosync configuration.

service {
    name: pacemaker
    ver: 0
}

Hope somebody could help me with this issue

Thanks in advance

Upvotes: -1

Views: 1511

Answers (1)

Dedalo
Dedalo

Reputation: 131

For 2 nodes active/passive you should disable the quorum.

crm configure property no-quorum-policy=ignore

The cluster is active as long as the corosync service is active. You don't need to start explicitly pacemaker. You should have at least this lines about 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:

If you don't have this links or similar you should make it manually.

I hope this solves your problem

Upvotes: 0

Related Questions