我设法让HAproxy在故障转移配置中工作,如
architecture.txt文档中使用keepalived所建议的那样.
我使用了来自epel repo的CentOS 5.5,HAproxy rpm(haproxy-1.3.25-1.el5),以及来自CentOS测试仓库的keepalived rpm(keepalived-1.1.15-0.el5.centos).
这是我的keepalived配置
vrrp_script chk_haproxy { # Requires keepalived-1.1.13 script "killall -0 haproxy" # cheaper than pidof interval 2 # check every 2 seconds weight 2 # add 2 points of prio if OK } vrrp_instance VI_1 { interface eth0 state MASTER virtual_router_id 51 priority 101 # 101 on master,100 on backup virtual_ipaddress { 10.0.0.30 10.0.0.31 } track_script { chk_haproxy } }
我现在想要的是让我的备份节点能够在主服务器出现故障时接管打开的实际连接.
我听说这可以用多种方式完成(conntrackd),使用LVS功能等…
我想就最简单,最稳健的方法提出建议,使用可用的rpms是最好的.
谢谢
G
lvs_sync_daemon_inteface选项使MASTER能够保存连接状态并将其与BACKUP同步.试试这个:
原文链接:https://www.f2er.com/centos/373316.htmlvrrp_instance VI_1 { state MASTER interface eth0 lvs_sync_daemon_interface eth0 virtual_router_id 51 priority 101 # 101 on master,100 on backup virtual_ipaddress { 10.0.0.30 10.0.0.31 } track_script { chk_haproxy } }