标签:tar The ica xxx delay nec ipaddress sysctl systemctl
LVS+keepalived做Mysql集群的负载均衡:注:
1、LVS本身不对node做健康检查的,所以要借助keepalived
2、根据配置当某node down掉会有几秒判断时间,这点请注意。
负载均衡端:
注:
keepalived的log在/var/log/message里
! Configuration File for keepalived
global_defs {
notification_email {br/>aa@ming.com
}
notification_email_from aa@ming.com
smtp_server 10.0.0.10
smtp_connect_timeout 30
router_id LVS_DEVEL
vrrp_skip_check_adv_addr
vrrp_garp_interval 0
vrrp_gna_interval 0
}
vrrp_instance VI_1 {
state MASTER
interface eno1 (这里网卡名要写对)
virtual_router_id 51
priority 100
advert_int 3
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.0.1.10
}
}
virtual_server 10.0.1.10 3306 {
delay_loop 6
lb_algo rr
lb_kind DR (此处需改为DR)
persistence_atimeout 10
protocol TCP
real_server 10.0.1.2 3306 {
weight 1
TCP_CHECK {
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
connect_port 3306
}
}
real_server 10.0.1.3 3306 {
weight 1
TCP_CHECK {
connect_timeout 3
retry 3
delay_before_retry 1
connect_port 3306
}
}
real_server 10.0.1.4 3306 {
weight 1
TCP_CHECK {
connect_timeout 3
retry 3
delay_before_retry 1
connect_port 3306
}
}
}
:wq
Mysql node端(所有node都做):
net.ipv4.conf.lo.arp_ignore = 1
net.ipv4.conf.lo.arp_announce = 2
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2
:wq
验证(可以看到访问的为不同node):
标签:tar The ica xxx delay nec ipaddress sysctl systemctl
原文地址:https://blog.51cto.com/yangzhiming/2503258