keepalived配置文件详解.doc
文本预览下载声明
keepalived配置文件详解
global_defs {?? notification_email {? #指定keepalived在发生切换时需要发送email到的对象,一行一个??? sysadmin@fire.loc?? }?? notification_email_from Alexandre.Cassen@firewall.loc #指定发件人?? smtp_server localhost #指定smtp服务器地址?? smtp_connect_timeout 30 #指定smtp连接超时时间?? router_id LVS_DEVEL #运行keepalived机器的一个标识}vrrp_sync_group VG_1{ #监控多个网段的实例group {inside_network #实例名outside_network}notify_master /path/xx.sh #指定当切换到master时,执行的脚本netify_backup /path/xx.sh #指定当切换到backup时,执行的脚本notify_fault path/xx.sh VG_1 #故障时执行的脚本notify /path/xx.sh?smtp_alert #使用global_defs中提供的邮件地址和smtp服务器发送邮件通知}vrrp_instance inside_network {??? state BACKUP #指定那个为master,那个为backup,如果设置了nopreempt这个值不起作用,主备考priority决定??? interface eth0 #设置实例绑定的网卡??? dont_track_primary #忽略vrrp的interface错误(默认不设置)??? track_interface{ #设置额外的监控,里面那个网卡出现问题都会切换??? eth0??? eth1??? }??? mcast_src_ip #发送多播包的地址,如果不设置默认使用绑定网卡的primary ip??? garp_master_delay #在切换到master状态后,延迟进行gratuitous ARP请求??? virtual_router_id 50 #VPID标记??? priority 99 #优先级,高优先级竞选为master??? advert_int 1 #检查间隔,默认1秒????nopreempt?#设置为不抢占 注:这个配置只能设置在backup主机上,而且这个主机优先级要比另外一台高??? preempt_delay #抢占延时,默认5分钟??? debug #debug级别??? authentication { #设置认证??????? auth_type PASS #认证方式??????? auth_pass 111111 #认证密码??? }??? virtual_ipaddress { #设置vip??????? 00??? }}virtual_server 00 23 {??? delay_loop 6 #健康检查时间间隔??? lb_algo rr? #lvs调度算法rr|wrr|lc|wlc|lblc|sh|dh??? lb_kind DR? #负载均衡转发规则NAT|DR|RUN??? persistence_timeout 5 #会话保持时间??? protocol TCP #使用的协议??? persistence_granularity NETMASK #lvs会话保持粒度??? virtualhost string #检查的web服务器的虚拟主机(host:头)??????? sorry_serverIPADDR port #备用机,所有realserver失效后启用real_server 23 {??????????? weight 1 #默认为1,0为失效??????????? inhibit_on_failure #在服务器健康检查失效时,将其设为0,而不是直接从ipvs中删除???????????? notify_up string | quoted-string #在检测到server up后执行脚本??????????? notify_down string | quoted-string #在检测到server down后执行脚本????????????TCP_CHECK {??????????? connect_timeout 3 #连接超时时间??????????? nb_get_retry 3 #重连次数?????
显示全部