# 搭建LVS DR模式

> 来源：梦飞idc云平台 | 原文：https://www.mfisp.com/17357.html | 发布：2023-02-21 | 更新：2023-02-21 | 分类：建站教程、投稿分享

高可用搭建  
使用keepalived实现高可用  
主副节点Keepalived设置  
`vi /etc/keepalived/keepalived.conf`

 

! Configuration File for keepalived

 

global_defs {  
 router_id R1  
 }

 

vrrp_instance VI_1 {  
 # 副节点 SLAVE  
 state MASTER  
 interface ens37  
 virtual_router_id 66  
 # 副节点稍微降低，建议30  
 priority 80  
 advert_int 1  
 authentication {  
 auth_type PASS  
 auth_pass 1111  
 }  
 virtual_ipaddress {  
 120.10.10.100  
 }  
}

 

virtual_server 120.10.10.100 80 {  
 delay_loop 1  
 lb_algo rr  
 lb_kind DR  
 persistence_timeout 50  
 protocol TCP

 

real_server 120.10.10.12 80 {  
 weight 1  
 TCP_CHECK{  
 connect_port 80  
 connect_timeout 3  
 nb_get_retry 3  
 delay_before_retry 4  
 }  
 }  
 real_server 120.10.10.13 80 {  
 weight 1  
 TCP_CHECK{  
 connect_port 80  
 connect_timeout 3  
 nb_get_retry 3  
 delay_before_retry 4  
 }  
 }  
}

 

``

---
本页由 梦飞idc云平台（https://www.mfisp.com）提供。站点导航见 https://www.mfisp.com/llms.txt
