<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>High Availiability on nagg.eu</title><link>https://nagg.eu/tags/high-availiability/</link><description>Recent content in High Availiability on nagg.eu</description><generator>Hugo</generator><language>en</language><lastBuildDate>Wed, 13 Jan 2021 00:00:00 +0000</lastBuildDate><atom:link href="https://nagg.eu/tags/high-availiability/index.xml" rel="self" type="application/rss+xml"/><item><title>Keepalived and libvirt MACVTAP network interfaces</title><link>https://nagg.eu/keepalived-and-libvirt-macvtap-network-interfaces/</link><pubDate>Wed, 13 Jan 2021 00:00:00 +0000</pubDate><guid>https://nagg.eu/keepalived-and-libvirt-macvtap-network-interfaces/</guid><description>&lt;p&gt;Keepalived is a routing software written in C that can be used to setup load
balancing and high availiability for Linux machines.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;NOTE: hypervisor is Debian 10 (Buster) with &lt;code&gt;libvirt&lt;/code&gt; and &lt;code&gt;qemu/kvm&lt;/code&gt;, virtual
machines also are Debian 10 (Buster).&lt;/em&gt;&lt;/p&gt;
&lt;h2 id="keepalived-configuration"&gt;Keepalived configuration&lt;/h2&gt;
&lt;p&gt;Install &lt;code&gt;keepalived&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ apt install keepalived
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Install &lt;code&gt;nginx&lt;/code&gt;, it will be use to check that keepalived is actually working:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ apt install nginx
$ systemctl enable --now nginx
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Configure &lt;code&gt;keepalived&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ vi /etc/keepalived/keepalived.conf
---
global_defs {
 enable_script_security # prevents tampering with the check script
 script_user root # defines which user runs the check script
}

vrrp_script chk_nginx {
 script &amp;#34;/opt/scripts/nginx-check.sh&amp;#34;
 interval 2 # run script every 2 seconds
 weight 2 # add 2 points if OK
}

vrrp_instance VI_1 {
 interface enp2s0 # interface to monitor
 virtual_router_id 51
 priority 101 # MASTER 101, BACKUP 100
 advert_int 1
 nopreempt # comment to not have the VIP go back to MASTER 
 # -&amp;gt; when it comes back online
 authentication {
 auth_type PASS
 auth_pass myPass # maximum 8 chars
 }
 virtual_ipaddress {
 10.10.0.12/24 # VIP (Virtual IP Address)
 }
 track_script {
 chk_nginx
 }
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Also add a script to check if &lt;code&gt;nginx&lt;/code&gt; is alive and well:&lt;/p&gt;</description></item></channel></rss>