Heartbeat
Introduction
Heartbeat solution de création de VIP. Permet de le fail over entre deux machines. Elle peut se compléter avec la solution Pacemaker pour la création de Quorum et donc avoir plus de noeuds.
sans Pacemaker
[!note] ne pas depasser deux noeuds
Installer Heartbeat
sudo apt install heartbeat # Debian/Ubuntu
sudo yum install heartbeat # CentOS/RHEL
Fichier
/etc/ha.d/
├── harc
├── rc.d
│ ├── ask_resources
│ ├── hb_takeover
│ ├── ip-request
│ ├── ip-request-resp
│ └── status
├── README.config
├── resource.d
│ ├── apache
│ ├── AudibleAlarm
│ ├── db2
│ ├── Delay
│ ├── Filesystem
│ ├── hto-mapfuncs
│ ├── ICP
│ ├── ids
│ ├── IPaddr
│ ├── IPaddr2
│ ├── IPsrcaddr
│ ├── IPv6addr
│ ├── LinuxSCSI
│ ├── LVM
│ ├── MailTo
│ ├── OCF
│ ├── portblock
│ ├── Raid1
│ ├── SendArp
│ ├── ServeRAID
│ ├── WAS
│ ├── WinPopup
│ └── Xinetd
└── shellfuncs
ha.cf
crée le fichier ha.cf dans /etc/ha.d/ha.cf
logfacility local0
keepalive 2
deadtime 10
warntime 5
initdead 20
udpport 694
bcast <interface ip a>
auto_failback on
node <hostname -s>
node <hostname -s>
authkeys
créé le fichier “authkeys” dans /etc/ha.d/authkeys
auth 1
1 crc
Puis droit en lecture et ecriture
chmod 600 /etc/ha.d/authkeysharesources
cree le fichier “haresources” pour configurer /etc/ha.d/haresources
node1 IPaddr::<VIP>/24/eth0 haproxy
-
node1: le nœud principal -
IPaddr::...: l’IP flottante + CIDR + interface -
haproxy: script de ressource (Heartbeat le connaît car/etc/init.d/haproxyexiste)
active
sudo systemctl enable --now heartbeatlogs
Pour vérifier les logs
tail -f /var/log/syslog # Debian
tail -f /var/log/messages # CentOSsuppression du UUID
systemctl stop heartbeat
rm -f /var/lib/heartbeat/hb_uuid
systemctl start heartbeat