本来想自己写一下的,奈何别人的blog写的太好了,再当一次搬运工
https://blog.51cto.com/13043516/2309505
https://blog.csdn.net/weixin_40470303/article/details/80541639
https://blog.csdn.net/Ki8Qzvka6Gz4n450m/article/details/79119665
https://www.cnblogs.com/liwei0526vip/p/6370103.html
http://www.it165.net/admin/html/201401/2248.html
https://blog.csdn.net/lupengfei1009/article/details/86514445
LVS负责调度,keepalved负责检查rs是否存活以及负载主备切换,只对keepalived配置即可,单独部署lvs需要手动添加规则
问题及解决:关于lvs+keepalived只加入一台realserver问题
https://www.cnblogs.com/LD-linux/p/lvs.html
就因为一个空格的事,搞这么半天
http://blog.chinaunix.net/uid-25723371-id-4835004.html
keepalived配置文件
! Configuration File for keepalived
global_defs {
notification_email {
acassen@firewall.loc
failover@firewall.loc
sysadmin@firewall.loc
}
notification_email_from Alexandre.Cassen@firewall.loc
smtp_server 192.168.200.1
smtp_connect_timeout 30
router_id LVS_DEVEL
}
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.9.224
}
}
virtual_server 192.168.9.224 443 {
delay_loop 6
lb_algo rr
lb_kind NAT
nat_mask 255.255.255.0
protocol TCP
real_server 192.168.12.127 443 {
weight 1
TCP_CHECK {
connect_timeout 10
nb_get_retry 3
delay_before_retry 3
connect_port 443
}
}
real_server 192.168.12.72 443 {
weight 1
TCP_CHECK {
connect_timeout 10
nb_get_retry 3
delay_before_retry 3
connect_port 443
}
}
}
virtual_server 192.168.9.224 9443 {
delay_loop 6
lb_algo rr
lb_kind NAT
protocol TCP
real_server 192.168.12.127 9443 {
weight 1
TCP_CHECK {
connect_timeout 10
nb_get_retry 3
delay_before_retry 3
connect_port 9443
}
}
real_server 192.168.12.72 9443 {
weight 1
TCP_CHECK {
connect_timeout 10
nb_get_retry 3
delay_before_retry 3
connect_port 9443
}
}
}