配置文件修改注意:
1,在keepalived源码包中有keepalived.conf 的原始配置文件,把这个原始配置文件复制到/etc/keepalived/keepalived.conf 目录下,然后修改这个配置文件,修改内容如下:
! Configuration File for keepalived
global_defs {
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id mysql_201
}
vrrp_instance VI_1 {
state BACKUP
interface eth0
virtual_router_id 51
priority 90
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.11.202
}
}
virtual_server 192.168.11.202 3306 {
delay_loop 2
lb_algo wrr
lb_kind DR
nat_mask 255.255.255.0
persistence_timeout 50
protocol TCP
real_server 192.168.11.201 3306 {
weight 3
notify_down /usr/local/script/mysql.sh
TCP_CHECK {
connect_timeout 10
nb_get_retry 3
delay_before_retry 3
connect_port 3306
}
}
}