Compilation and installation KeePaliveD-2.0.17

Installation:
Download the source package from the official website
wget https://www.keepalived.org/software/keepalived-2.0.17.tar.gz

Install some dependency packages needed for keepalived
yum install openssl-devel popt-devel libnl-devel kernel-devel gcc -y

Unzip the source code and install it to /usr/local/keepalived

tar zxvf keepalived-2.0.17.tar.gz
cd keepalived-2.0.17
./configure --prefix=/usr/local/keepalived
make && make install

Start keepalived service

systemctl enable keepalived
systemctl start keepalived

Starting error, the default read configuration file is /etc/keepalived /keepalived.conf

mkdir -p /etc/keepalived
ln -s /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/
systemctl start keepalived
systemctl status keepalived

Compile, install and configure keepalived-2.0.17

Configuration:
master:

! Configuration File for keepalived

global_defs {
notification_email {
[email protected]
}
notification_email_from [email protected]
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id MASTER
script_user root
enable_script_security
}

vrrp_script check_haproxy {
script "/etc/keepalived/scripts/check_haproxy.sh"
interval 3
}

vrrp_instance http {
state BACKUP
interface eth0
dont_track_primary
nopreempt

track_interface {
eth0
}

garp_master_delay 6
virtual_router_id 60
priority 110
advert_int 1

authentication {
auth_type PASS
autp_pass 1234
}

virtual_ipaddress {
192.168.12.53/24 brd 192.168.12.255 dev eth0 label eth0:1
}

track_script {
check_haproxy
}

notify_master /etc/keepalived/scripts/state_master.sh
notify_backup /etc/keepalived /scripts/state_backup.sh
notify_fault /etc/keepalived/scripts/state_fault.sh
}

backup:

! Configuration File for keepalived

global_defs {
notification_email {
[email protected]
}
notification_email_from [email protected]
smtp_server 127.0.0.1
smtp_connect_timeout 30< br /> router_id BACKUP
script_user root
enable_script_security
}

vrrp_script check_haproxy {
script "/etc/keepalived/scripts/check_haproxy.sh"< br /> interval 3
}

vrrp_instance http {
state BACKUP
interface eth0
dont_track_primary
nopreempt

track_interface {
eth0
}

garp_master_delay 6
virtual_router_id 60
priority 105
advert_int 1

authentication {
auth_type PASS
autp_pass 1234
}

virtual_ipaddress {
192.168.12.53/24 brd 192.168.12.255 dev eth0 label eth0:1
}

track_script {
check_haproxy
}

notify_master /etc/keepalived/scripts/state_master.sh
notify_backup /etc/keepalived/scripts/state_backup.sh
notify_fault /etc/keepalived/scripts/state_fault.sh
}

Leave a Comment

Your email address will not be published.