Keepalived ist eine Software um Hochverfügbarkeit in Linux Umgebungen zu gewährleisten. Keepalived verwendet u.a [[VRRP]] ([[https://docs.linuxfabrik.ch/software/keepalived.html#vrrp-advertisement]])
{{vrrp.jpeg}}
=====Installation=====
Um Prozesse etc. zu überwachen braucht man mind. Version 2.0, die muss man selbst kompilieren.
sudo apt install -y keepalived
Die Konfig liegt unter
/etc/keepalived/keepalived.conf
====Selbst Kompilieren====
===Ubuntu===
Das Github Repo verwendet autoconf.
sudo apt install build-essential libssl-dev libnl-3-dev libnl-genl-3-dev autoconf automake libtool
git clone https://github.com/acassen/keepalived.git
cd keepalived
./autogen.sh
./configure
make
sudo make install
sudo keepalived -v
Service Unit anlegen!!!
sudo nano /etc/systemd/system/keepalived.service
[Unit]
Description=Keepalived Daemon
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/sbin/keepalived --dont-fork --log-console
Restart=always
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reexec
sudo systemctl daemon-reload
sudo systemctl enable keepalived
sudo systemctl start keepalived
===Alma Linux 8===
dnf install -y gcc make openssl-devel libnl3-devel autoconf automake libtool git
git clone https://github.com/acassen/keepalived.git
cd keepalived
./autogen.sh
./configure
make
sudo make install
sudo nano /etc/systemd/system/keepalived.service
[Unit]
Description=Keepalived Daemon
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
ExecStart=/usr/local/sbin/keepalived --dont-fork --log-console
ExecReload=/bin/kill -HUP $MAINPID
Restart=always
[Install]
WantedBy=multi-user.target
=====Konfiguration=====
====Master====
vrrp_instance VI_1 {
state MASTER
interface ens160
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass geheim
}
virtual_ipaddress {
172.21.0.166
}
}
====Backup====
vrrp_instance VI_1 {
state BACKUP
interface ens160
virtual_router_id 51
priority 90
advert_int 1
authentication {
auth_type PASS
auth_pass geheim
}
virtual_ipaddress {
172.21.0.166
}
}
=====Health=====
Man kann Prozesse, Dateien, Interfaces und eigene Scripte "tracken".
====Prozesse====
Siehe [[https://docs.linuxfabrik.ch/software/keepalived.html#prozesse-mit-keepalived-tracken]].
Funktioniert erst ab Version 2.0! Muss man selber kompilieren.
====Dateien====
Siehe [[https://docs.linuxfabrik.ch/software/keepalived.html#dateien-mit-keepalived-tracken]]
====Interfaces====
Siehe [[https://docs.linuxfabrik.ch/software/keepalived.html#interfaces-mit-keepalived-tracken]]
====Scripts====
Siehe [[https://docs.linuxfabrik.ch/software/keepalived.html#scripts-mit-keepalived-tracken]]
====Notifications====
* [[https://docs.linuxfabrik.ch/software/keepalived.html#notifications]]