首页
Linux教程
Linux实战教程
Shell教程
Mysql教程
Keepalived教程
Linux基础教程
Linux进阶教程
运维题库
运维干货
视频教程
运维资讯
资源下载
关于我们
首页 LVS教程场景2:实现MySQL高可用

场景1:实现MySQL负载

场景3:实现Web4-7层负载

1.8.5 场景2:实现LVS+keepalived db高可用

lb4-01配置:
[root@lb4-01 keepalived]# cat keepalived.conf
global_defs {
   router_id lb01
}
vrrp_instance VI_2 {
    state MASTER
    interface eth1
    virtual_router_id 52
    priority 150
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
      172.16.1.18/24 dev eth1 label eth1:18
    }
}

#port 3306
##oldboy service  virtual_server 
virtual_server 172.16.1.18 3306 {
    delay_loop 6            
    lb_algo wrr                
    lb_kind DR
    persistence_timeout 20     
    protocol TCP       
real_server 172.16.1.7 3306 {
    weight 1              
    TCP_CHECK {
    connect_timeout 5       
    #nb_get_retry 3
    delay_before_retry 3
    connect_port 3306
    }
}

real_server 172.16.1.51 3306 {
    weight 1
    TCP_CHECK {
    connect_timeout 5
   # nb_get_retry 3
    delay_before_retry 3
    connect_port 3306
    }
  }
}
lb4-02配置:
[root@lb4-02 keepalived]# cat keepalived.conf
global_defs {
   router_id lb4-02
}
vrrp_instance VI_2 {
    state BACKUP
    interface eth1
    virtual_router_id 52
    priority 50
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
      172.16.1.18/24 dev eth1 label eth1:18
    }
}

#port 3306
##oldboy service  virtual_server 
virtual_server 172.16.1.18 3306 {
    delay_loop 6            
    lb_algo wrr                
    lb_kind DR
    persistence_timeout 20     
    protocol TCP      
real_server 172.16.1.7 3306 {
    weight 1              
    TCP_CHECK {
    connect_timeout 5       
    #nb_get_retry 3
    delay_before_retry 3
    connect_port 3306
    }
}

real_server 172.16.1.51 3306 {
    weight 1
    TCP_CHECK {
    connect_timeout 5
   # nb_get_retry 3
    delay_before_retry 3
    connect_port 3306
    }
  }
}

重启keep完成

本文链接:https://www.yunweibase.com/archives/144

场景1:实现MySQL负载

场景3:实现Web4-7层负载

网友评论comments

发表评论

邮箱地址不会被公开。 必填项已用*标注

暂无评论

Copyright © 运维基地 保留所有权
扫二维码
扫二维码
返回顶部