Debian HA apache2 server. (pacmeker, corosync)
Instalacia pacemaker:
apt install -y pacemaker corosync crmsh
Nastavenie clustru corosync:
nano /etc/corosync/corosync.conf
# Totem Protocol Configuration
totem {
version: 2
cluster_name: hakase-cluster
transport: udpu
# Interface configuration for Corosync
interface {
ringnumber: 0
bindnetaddr: 10.0.15.0
broadcast: yes
mcastport: 5407
}
}
# Nodelist - Server List
nodelist {
node {
ring0_addr: web01
}
node {
ring0_addr: web02
}
}
# Quorum configuration
quorum {
provider: corosync_votequorum
}
# Corosync Log configuration
logging {
to_logfile: yes
logfile: /var/log/corosync/corosync.log
to_syslog: yes
timestamp: on
}
service {
name: pacemaker
ver: 0
}
Hosty web01 a web02 je potrebne nahrav v lokalnom DNS
Po spusteni sluzieb:
Nastavenie corosync & pacemaker:
crm configure property stonith-enabled=false
crm configure property no-quorum-policy=ignore
Vytvorenie flating IP
pcs resource create floating_ip ocf:heartbeat:IPaddr2 ip=147.232.103.6 cidr_netmask=28 op monitor interval=5s
Zmena nastavenia v:
nano /etc/systemd/system/multi-user.target.wants/pacemaker.service
TimeoutStopSec=30s
Nastavenie apache clustra:
pcs resource create WebServer ocf:heartbeat:apache configfile=/etc/apache2/apache2.conf statusurl="http://127.0.0.1/server-status" op monitor interval=20s
Nastavenie skupiny sluzieb:
crm configure group web_balancing WebServer floating_ip