User Tools

Site Tools


пакет_heartbeat

This is an old revision of the document!


Пакет HEARTBEAT

Преимущества перед CARP и VRRP

  • Возможность управления временными характеристиками взаимодействия узлов
  • Возможность распределения сервисов по узлам кластера

Установка и базовая настройка

Debian/Ubuntu

root@nodeN:~# apt install heartbeat

root@nodeN:~# zless /usr/share/doc/heartbeat/ha.cf.gz

Debian/Ubuntu

nodeN# cat /etc/ha.d/ha.cf
#bcast eth0
#ucast eth0 192.168.X.3-N
deadtime 30
initdead 120
auto_failback off
node node1.corpX.un
node node2.corpX.un
debugfile /var/log/ha-debug
logfile /var/log/ha-log
nodeN# cat /etc/ha.d/authkeys
auth 1
1 sha1 heartbeatpass
nodeN# chmod 600 /etc/ha.d/authkeys

Управление ресурсами

nodeN# ls /etc/init.d/

nodeN# ls /etc/ha.d/resource.d/

node1# /etc/ha.d/resource.d/IPaddr2 192.168.X.10/32/eth0 start

node1# /etc/ha.d/resource.d/IPaddr2 192.168.X.10/32/eth0 stop

nodeN# cat /etc/ha.d/haresources
node1.corpX.un IPaddr2::192.168.X.10/32/eth0 proftpd
#node2.corpX.un \
#    IPaddr::192.168.X.20/32 \
#    IPaddr2::192.168.X.20/32/eth0 \
#    smbd

Комментарии, пробелы после \ и пустые строки не допустимы!

В freebsd использовать IPaddr, в Linux IPaddr2 (иначе может привязать адрес не к тому интерфейсу)

Запуск/Остановка

Debian/Ubuntu

root@nodeN:~# systemctl enable heartbeat --now

root@nodeN:~# systemctl disable heartbeat --now

Отладка

nodeN# tail -f /var/log/ha-debug

nodeN# cat /var/log/ha-debug | grep -v ERR | grep -v autotoken

nodeN# service heartbeat status

nodeN# cl_status nodestatus nodeN.corpX.un
пакет_heartbeat.1791974212.txt.gz · Last modified: 2026/10/14 13:36 by val