Installation et Configuration de Pacemaker

From Deimos.fr / Bloc Notes Informatique
Revision as of 20:41, 21 December 2010 by Deimos (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Flattr-badge-large.png

1 Introduction

Pacemaker est la suite logique de Heartbeat qui a fusionné avec d'autres logiciels libre afin d'arriver à une perfection. Pacemaker est donc un logiciel de gestion de ressources. Il doit être couplé à Corosync qui lui va gérer les échanges d'informations entre noeuds.

L'installation et la configuration est faites ici sur une Debian 6.

2 Installation

Pour l'installation, rien de plus simple sur une Debian :

Command aptitude
aptitude install pacemaker corosync

3 Configuration

3.1 Corosync

Pour la configuration de Corosync, nous allons avoir besoin de générer des clefs de cryptage pour l'échange d'informations intra clusters (entre les noeuds) :

Command corosync-keygen
> corosync-keygen
Corosync Cluster Engine Authentication key generator.
Gathering 1024 bits for key from /dev/random.
Press keys on your keyboard to generate entropy.
Press keys on your keyboard to generate entropy (bits = 136).
Press keys on your keyboard to generate entropy (bits = 200).
Press keys on your keyboard to generate entropy (bits = 264).
Press keys on your keyboard to generate entropy (bits = 328).
Press keys on your keyboard to generate entropy (bits = 392).
Press keys on your keyboard to generate entropy (bits = 456).
Press keys on your keyboard to generate entropy (bits = 520).
Press keys on your keyboard to generate entropy (bits = 584).
Press keys on your keyboard to generate entropy (bits = 648).
Press keys on your keyboard to generate entropy (bits = 712).
Press keys on your keyboard to generate entropy (bits = 776).
Press keys on your keyboard to generate entropy (bits = 840).
Press keys on your keyboard to generate entropy (bits = 904).
Press keys on your keyboard to generate entropy (bits = 968).
Writing corosync key to /etc/corosync/authkey.

Envoyez ensuite avec un scp par exemple cette configuration vers les autres nodes :

Command scp
scp -r /etc/corosync root@nodex:/etc/

Ensuite éditez sur chacun des noeuds, le fichier de configuration de Corosync et adaptez la partie réseaux à chacun d'eux :

Configuration File /etc/corosync/corosync.conf
# Please read the openais.conf.5 manual page

totem {
    version: 2

    # How long before declaring a token lost (ms)
    token: 3000

    # How many token retransmits before forming a new configuration
    token_retransmits_before_loss_const: 10

    # How long to wait for join messages in the membership protocol (ms)
    join: 60

    # How long to wait for consensus to be achieved before starting a new round of membership configuration (ms)
    consensus: 3600

    # Turn off the virtual synchrony filter
    vsftype: none

    # Number of messages that may be sent by one processor on receipt of the token
    max_messages: 20

    # Limit generated nodeids to 31-bits (positive signed integers)
    clear_node_high_bit: yes

    # Disable encryption
    secauth: off

    # How many threads to use for encryption/decryption
    threads: 0

    # Optionally assign a fixed node id (integer)
    # nodeid: 1234

    # This specifies the mode of redundant ring, which may be none, active, or passive.
    rrp_mode: none

    interface {
        # The following values need to be set based on your environment 
        ringnumber: 0
        bindnetaddr: 192.168.20.4
        mcastaddr: 226.94.1.1
        mcastport: 5405
    }
}

amf {
    mode: disabled
}

service {
    # Load the Pacemaker Cluster Resource Manager
    ver:       0
    name:      pacemaker
}

aisexec {
        user:   root
        group:  root
}

logging {
        fileline: off
        to_stderr: yes
        to_logfile: no
        to_syslog: yes
    syslog_facility: daemon
        debug: off
        timestamp: on
        logger_subsys {
                subsys: AMF
                debug: off
                tags: enter

Pour finir, éditez le fichier /etc/default/corosync afin de lui dire qu'il faut qu'il démarre au boot de la machine :

Configuration File /etc/default/corosync
 # start corosync at boot [yes|no]
 START=yes

Maintenant activons notre nouvelle configuration sur tous les noeuds :

Command
/etc/init.d/corosync restart

Maintenant on peut vérifier l'état du cluster :

Command crm_mon
> crm_mon --one-shot -V
crm_mon[427]: 2010/12/20_21:51:54 ERROR: unpack_resources: Resource start-up disabled since no STONITH resources have been defined
crm_mon[427]: 2010/12/20_21:51:54 ERROR: unpack_resources: Either configure some or disable STONITH with the stonith-enabled option
crm_mon[427]: 2010/12/20_21:51:54 ERROR: unpack_resources: NOTE: Clusters with shared data need STONITH to ensure data integrity
============
Last updated: Mon Dec 20 21:51:54 2010
Stack: openais
Current DC: zazu - partition WITHOUT quorum
Version: 1.0.9-74392a28b7f31d7ddc86689598bd23114f58978b
2 Nodes configured, 2 expected votes
0 Resources configured.
============
 
Online: [ zazu shenzi ]

Maintenant nous allons configurer quelques choses :

  • Pas de quorum (car cluster à 2 noeuds)
  • Pas de Stonith (Fencing)
  • Pour le stickness, c'est pour ne pas avoir de ressource en auto-failback
Command crm
> crm
crm(live)# configure
crm(live)configure# property no-quorum-policy=ignore
crm(live)configure# property stonith-enabled=false
crm(live)configure# property default-resource-stickiness=1000
crm(live)configure# commit
crm(live)configure# bye