User Tools

Site Tools


пакет_heartbeat

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
пакет_heartbeat [2019/03/22 15:23]
val [Debian/Ubuntu/FreeBSD]
пакет_heartbeat [2026/10/14 13:38] (current)
val [Отладка]
Line 6: Line 6:
   * Возможность распределения сервисов по узлам кластера   * Возможность распределения сервисов по узлам кластера
  
-===== Установка и настройка =====+===== Установка и базовая ​настройка =====
  
 ==== Debian/​Ubuntu ==== ==== Debian/​Ubuntu ====
 <​code>​ <​code>​
 root@nodeN:​~#​ apt install heartbeat root@nodeN:​~#​ apt install heartbeat
- 
-root@nodeN:​~#​ systemctl enable heartbeat 
  
 root@nodeN:​~#​ zless /​usr/​share/​doc/​heartbeat/​ha.cf.gz root@nodeN:​~#​ zless /​usr/​share/​doc/​heartbeat/​ha.cf.gz
- 
-root@nodeN:​~#​ cd /etc/ha.d/ 
 </​code>​ </​code>​
-==== FreeBSD ==== 
  
-<​code>​ +==== Debian/​Ubuntu ====
-[nodeN:~] # pkg install heartbeat +
- +
-[nodeN:~] # ln -s /​usr/​local/​bin/​perl /​usr/​bin/​perl +
- +
-[nodeN:~] # ls /​usr/​local/​share/​doc/​heartbeat/​ +
- +
-[nodeN:~] # cd /​usr/​local/​etc/​ha.d/​ +
-</​code>​ +
- +
-==== Debian/​Ubuntu/​FreeBSD ​==== +
- +
-  * При использовании 2-го интерфейса будут ошибки в логах из-за общей среды передачи. Для исправления ситуации можно использовать 0-ой интерфейс.+
  
 <​code>​ <​code>​
-nodeN# cat ha.cf+nodeN# cat /etc/ha.d/ha.cf
 </​code><​code>​ </​code><​code>​
-#​bcast ​em2 +#​bcast ​eth0 
-bcast eth2 +#​ucast ​eth0 192.168.X.3-N
-#​ucast ​eth1 172.16.1.Y +
-#ucast eth2 slave+
 deadtime 30 deadtime 30
 initdead 120 initdead 120
Line 49: Line 30:
 logfile /​var/​log/​ha-log logfile /​var/​log/​ha-log
 </​code><​code>​ </​code><​code>​
-nodeN# cat authkeys+nodeN# cat /etc/ha.d/authkeys
 </​code><​code>​ </​code><​code>​
 auth 1 auth 1
 1 sha1 heartbeatpass 1 sha1 heartbeatpass
 </​code><​code>​ </​code><​code>​
-nodeN# chmod 600 authkeys+nodeN# chmod 600 /etc/ha.d/authkeys 
 +</​code>​
  
-nodeN# ​+===== Управление ресурсами ===== 
 +<​code>​ 
 +nodeN# ​ls /​etc/​init.d/​
  
-nodeN# ​+nodeN# ​ls /​etc/​ha.d/​resource.d/​
  
-nodeN# cat resource.d/ftpserv +node1# /etc/ha.d/resource.d/IPaddr2 192.168.X.10/32/eth0 start
-</code><​code>​ +
-#!/bin/sh +
-# Don't forget disable autostart service +
-# Uncomment starting services compatible with FreeBSD/​Ubuntu +
-case $1 in +
-start) +
-#        service ftpd onestart +
-#        service proftpd start +
-        ;; +
-stop) +
-#        service ftpd onestop +
-#        service proftpd stop +
-        ;; +
-esac+
  
-exit 0 +node1# /etc/ha.d/resource.d/IPaddr2 192.168.X.10/​32/​eth0 stop
-</​code><​code>​ +
-nodeN# chmod +x resource.d/ftpserv+
  
-nodeN# cat haresources+nodeN# cat /etc/ha.d/haresources
 </​code><​code>​ </​code><​code>​
 node1.corpX.un IPaddr2::​192.168.X.10/​32/​eth0 proftpd node1.corpX.un IPaddr2::​192.168.X.10/​32/​eth0 proftpd
Line 92: Line 60:
 В freebsd использовать IPaddr, в Linux IPaddr2 (иначе может привязать адрес не к тому интерфейсу) В freebsd использовать IPaddr, в Linux IPaddr2 (иначе может привязать адрес не к тому интерфейсу)
  
-===== Запуск =====+===== Запуск/​Остановка ​=====
  
-==== FreeBSD ​====+==== Debian/​Ubuntu ​====
 <​code>​ <​code>​
-[nodeN:~] # service ​heartbeat ​rcvar+root@nodeN:​~# ​systemctl enable ​heartbeat ​--now
  
-[nodeN:~] # service heartbeat start +root@nodeN:​~# ​systemctl disable ​heartbeat ​--now
-</​code>​ +
- +
-==== Ubuntu/​Debian ==== +
-<​code>​ +
-root@nodeN:​~# ​service ​heartbeat ​start+
 </​code>​ </​code>​
  
-===== Проверки =====+===== Отладка =====
 <​code>​ <​code>​
-nodeN# ​cat /​var/​log/​ha-debug ​| grep -v ERR | grep -v autotoken+nodeN# ​tail -f /​var/​log/​ha-debug
  
 nodeN# service heartbeat status nodeN# service heartbeat status
пакет_heartbeat.1553257434.txt.gz · Last modified: 2019/03/22 15:23 by val