We're here to assist with any of your needs, don't hestitate to reach out.
Keepalived is a routing software suite for Linux that provides high availability (HA) for Linux systems by monitoring health, automatically failing over, and load balancing multiple servers or network links.
To install Keepalived on Ubuntu 18.04, you can follow these steps:
sudo apt update
sudo apt install keepalived
After installation, you need to configure Keepalived according to your specific needs. The main configuration file for Keepalived is located at /etc/keepalived/keepalived.conf
. You can edit this file using a text editor of your choice, such as nano or vim.
Here is a minimal example configuration to get you started:
! Configuration File for keepalived
vrrp_script chk_nginx {
script "/etc/keepalived/nginx_check.sh"
interval 2
weight -3
}
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 101
unicast_peer {
192.168.1.2
}
virtual_ipaddress {
192.168.1.100
}
authentication {
auth_type PASS
auth_pass MySecretPassword
}
track_script {
chk_nginx
}
}
In this example, we define a VRRP instance named VI_1. It is set to achieve high availability for an NGINX web server. The script "/etc/keepalived/nginx_check.sh"
is used to check if NGINX is running. The virtual IP address 192.168.1.100
is assigned to the Master node (priority 101) and will automatically failover to the Backup node if the Master node becomes unavailable.
After making the necessary configuration changes, you can restart Keepalived to apply the new configuration:
sudo systemctl restart keepalived
You have now successfully installed and configured Keepalived on Ubuntu 18.04. Keepalived will monitor the health of your servers or network links and failover if necessary, providing high availability for your Linux systems.
What our customers say about us
Create your free account today.