piranha配置

典型的高可用负载均衡
1)lvs + ldirectord + heartbeat
lvs(ipvsadmin) 调度器,将用户请求分发到后端真实服务器,不负责健康检查
ldirectord 服务监控,真实服务器的服务异常,将其从lvs节点表中去除,恢复后添加
heartbeat 高可用,监控lvs节点是否正常,控制vip飘移

2) lvs + keepalived
lvs
keepalived

3) piranha

yum -y install piranha

dr /etc/sysctl.conf

net.ipv4.ip_forward = 1

realserver /etc/sysctl.conf

net.ipv4.conf.lo.arp_ignore = 1
net.ipv4.conf.lo.arp_announce = 2
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2 

sysctl -p

/etc/sysconfig/ha/lvs.cf

service = lvs
primary = 10.10.100.12
backup = 10.10.100.13
backup_active = 1
heartbeat = 1
heartbeat_port = 1050
keepalive = 6
deadtime = 10
debug_level = NONE

network = direct

web 80 {
       address = 10.10.100.11 em2:0
       vip_nmask = 255.255.255.255
       fwmark = 100
       active = 1
       load_monitor = uptime
       timeout = 5
       reentry = 10
       port = http
       send = "GET / HTTP/1.0\r\n\r\n"
       expect = "HTTP"
       scheduler = sh
       persistent = 300
       pmask = 255.255.255.255
       protocol = tcp

       srv01 {
               address = 192.168.10.2
               active = 1
               weight = 1
       }

       srv02 {
               address = 192.168.10.3
               active = 1
               weight = 1
       }
}

/etc/sysconfig/network-scripts/ifcfg-lo:0

DEVICE=lo:0
IPADDR=10.10.100.11
NETMASK=255.255.255.255
ONBOOT=yes

/etc/sysconfig/network-scripts/route-lo:0

10.10.100.11/32 dev lo:0

http://www.gossamer-threads.com/lists/lvs/users/24231
http://www.ultramonkey.org/2.0.1/topologies/sl-ha-lb-eg.html

你可能感兴趣的:(配置)