本文主要是介绍Linux集群之HA(高可用集群)篇,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
LVS+Keepalive网络结构:
IP | 备注 |
---|---|
120.10.10.10 | ipvsadm master |
120.10.10.11 | ipvsadm slave |
120.10.10.12 | web1 |
120.10.10.13 | web2 |
1、搭建LVS DR模式,见上一篇文章Linux集群之LB(负载均衡集群)篇
2、高可用搭建
使用Keepalived实现高可用
主副节点Keepalived设置
vi /etc/keepalived/keepalived.conf
! Configuration File for keepalivedglobal_defs {router_id R1}vrrp_instance VI_1 {# 副节点 SLAVEstate MASTERinterface ens37virtual_router_id 66# 副节点稍微降低,建议30priority 80advert_int 1authentication {auth_type PASSauth_pass 1111}virtual_ipaddress {120.10.10.100}
}virtual_server 120.10.10.100 80 {delay_loop 1lb_algo rrlb_kind DRpersistence_timeout 50protocol TCPreal_server 120.10.10.12 80 {weight 1TCP_CHECK{connect_port 80connect_timeout 3nb_get_retry 3delay_before_retry 4}}real_server 120.10.10.13 80 {weight 1TCP_CHECK{connect_port 80connect_timeout 3nb_get_retry 3delay_before_retry 4}}
}
这篇关于Linux集群之HA(高可用集群)篇的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!