Keepalived has three configuration areas. Note that not three configuration files are the configuration areas of three different categories in a configuration file, including global configuration, vrrpd configuration, and LVS configuration.
! Configuration file for keepalived
################################ Global configuration ###### ###################################
Global_defs {icationication_email {# specifies the object to which an email is sent when keepalived is switched, one [email protected]} notification_email_from [email protected] # specify the sender smtp_server 192.168.200.1 # specify the SMTP server address smtp_connect_timeout 30 # specify the SMTP connection timeout value router_id lvs_devel # an identifier for running the keepalived}
############################### Vrrp configuration ###### ###################################
# Vrrp instance definition block vrrp_instance vi_1 {state master # specify the one as the master and the one as the backup. If the value # nopreempt is set, priority determines interface eth0 # sets the network adapter virtual_router_id 51 bound to the instance # vpid mark and route ID. You can view priority 100 # priority through # tcpdump vrrp, high-priority campaign is master advert_int 1 # Check Interval, 1 second authentication by default {# Set authentication auth_type pass # authentication method auth_pass 1111 # authentication password} virtual_ipaddress {# Set VIP 192.168.200.16 192.168.200.17 192.168.200.18 }}
################################# LVS Configuration ######################################## #####
# Virtual server defined block virtual_server 192.168.200.100 443 {# VIP port delay_loop 6 # Health Check Interval lb_algo RR # LVS scheduling algorithm RR | WRR | LC | wlc | lblc | sh | DH lb_kind Nat # Server Load balancer forwarding rule Nat | Dr | run nat_mask 255.255.255.0 # Nat mask persistence_timeout 50 # session persistence protocol TCP # used protocol sorry_server <ipaddr> <port> # backup machine, enable real_server 192.168.201.100 443 {# Rip port weight 1 # default value: inhibit_on_failure # When the server health check fails, set it to 0, instead of directly deleting the notify_up script (absolute path) from ipvs # execute the notify_down script (absolute path) after detecting the server up) # execute the script ssl_get {URL {path/digest ff20ad2481f97b1754ef3e12ecd3a9cc after detecting the server down # Check the URL, multiple status_code 200 # Check return status code} URL {path/MRTG/digest timeout} connect_timeout 3 # connection timeout nb_get_retry 3 # reconnection Interval time connect_port 23 # port of the Health Check port }}}
This article from "step by step into the Linux World" blog, please be sure to keep this source http://linuxnote.blog.51cto.com/9876511/1652981
Detailed description of keepalive parameters for building a high-availability server