ldirectord+LVS
安装包
ldirectord-3.9.6-0rc1.1.2.x86_64.rpm
配置
每端口持久 (PPC)
- cp /usr/share/doc/ldirectord-3.9.6/ldirectord.cf /etc/ha.d/
- checktimeout=3(检测响应的时长)
- checkinterval=1(检测时间间隔)
- fallback=127.0.0.1:80(Sorry Server)
- autoreload=yes
- quiescent=no
- virtual=10.0.0.100:80
- real=192.168.205.160:80 gate 3
- real=192.168.205.100:80 gate 1
- service=http
- scheduler=wrr
- persistent=600(持久连接时间 / s)
- protocol=tcp
- checktype=negotiate
- checkport=80
- request="test.html"
receive="test"(检测 test.html 页面是否含有 test 页面, 如果检测不到 (页面中没有或服务不能访问), 表明 RS 服务器已经停止服务, ldirectord 服务会自动将其在集群中删除)
注意: 虽然 LVS 服务器的网关可以是任意的, 但是在使用该架构的时候建议网关指向路由器网关, 使 LVS 服务器的回应包能到达客户端
每防火墙标记持久 (PFWMC)
- vim /etc/ha.d/ldirectord.cf (配置范例该文件中都有)
- checktimeout=3
- checkinterval=1
- fallback=127.0.0.1:80
- autoreload=yes
- quiescent=no
- virtual=10
- real=192.168.205.160 gate 3
- real=192.168.205.100 gate 1
- service=http
- scheduler=wrr
- protocol=fwm
- persistent=600(持久连接时间 / s)
- checktype=negotiate
- checkport=80
- request="test.html"
- receive="test"
注意: 安全起见防火墙将不用的端口设置策略禁止外界网络连接
路由器配置:
- iptables -A FORWARD -p tcp -m multiport --dports 80,443 -j ACCEPT
- iptables -I FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
- iptables -A FORWARD -j REJECT
来源: http://www.bubuko.com/infodetail-2546075.html