keepalived配置笔记草稿
来源:互联网 发布:伪随机关注算法 编辑:程序博客网 时间:2024/05/21 22:59
! Configuration File for keepalivedglobal_defs { notification_email { liangyuannao@163.com } notification_email_from admin@163.com smtp_server 127.0.0.1 smtp_connect_timeout 30 router_id LVS_DEVEL}vrrp_script check_running { #script /etc/keepalived/check.sh #interval 10 }vrrp_sync_group VGM { group { VI_LVS }#notify_master /etc/keepalived/master.sh #指定当切换到master时,执行的脚本 #notify_backup /etc/keepalived/backup.sh #指定当切换到backup时,执行的脚本 #notify_fault "path/xx.sh VG_1" #故障时执行的脚本 #notify /path/xx.sh #smtp_alert }vrrp_instance VI_LVS { state MASTER #备份服务器设置为backup interface eth3 #lvs_sync_daemon_inteface eth0 virtual_router_id 216 priority 150 #备份服务器设置小于150 advert_int 1 #检查间隔,默认1秒 authentication { auth_type PASS auth_pass 1111 }# track_interface { # eth0 # eth1 # eth2# eth3 # } virtual_ipaddress { 10.7.80.90 }}virtual_server 10.7.80.90 80 { delay_loop 6 #健康检查时间间隔 lb_algo wrr lb_kind NAT #persistence_timeout 50 #(这里可以让访问的IP在一段时间转发到相同的real_server) #persistence_granularity <NETMASK> #lvs会话保持粒度#sorry_server 192.168.200.200 1358 #备用机,所有realserver失效后启用 protocol TCP real_server 192.168.191.130 80 { weight 3inhibit_on_failure #在服务器健康检查失效时,将其设为0 TCP_CHECK { connect_timeout 5 #连接超时时间 nb_get_retry 3 #重连次数 delay_before_retry 3 #重连间隔时间 connect_port 80 #健康检查的端口 } } real_server 10.7.11.40 80 { weight 1 TCP_CHECK { connect_timeout 5 nb_get_retry 3 delay_before_retry 3 connect_port 80 }HTTP_GET { url { path / digest b7bd8391367e4cf9e4e85263ce313ae8 status_code 200 } #url { #path /mrtg/ #digest 9b3a0c85a887a256d6939da88aabd8cd #} connect_timeout 3 nb_get_retry 3 delay_before_retry 3 } }}