| -- realserver1(master1 18.16)
directory(barria 18.19) --| -- realserver2(node2 18.24)
| -- realserver3(node1 18.22) # 2 配置
## 2.1 directory(barria)
(1)add server-ip
net.ipv4.ip_forward = 1 #设置ipv4转发
ip addr add 172.16.18.13/24 dev p7p1 # 为网卡添加服务IP (2)add server
#for rtmp live
ipvsadm -A -t 172.16.18.13:8090 -s rr #add virtual service,ip:port即为LVS服务器ip:port
ipvsadm -a -t 172.16.18.13:8090 -r 172.16.18.16:8090 -g #添加real server的ip:port
ipvsadm -a -t 172.16.18.13:8090 -r 172.16.18.22:8090 -g
ipvsadm -a -t 172.16.18.13:8090 -r 172.16.18.24:8090 -g #for hls live
ipvsadm -a -t 172.16.18.13:8190 -r 172.16.18.16:8090 -g
ipvsadm -a -t 172.16.18.13:8190 -r 172.16.18.22:8090 -g
ipvsadm -a -t 172.16.18.13:8190 -r 172.16.18.24:8090 -g #for vod
ipvsadm -A -t 172.16.18.13:80 -s rr
ipvsadm -a -t 172.16.18.13:80 -r 172.16.18.16:80 -g
ipvsadm -a -t 172.16.18.13:80 -r 172.16.18.22:80 -g
ipvsadm -a -t 172.16.18.13:80 -r 172.16.18.24:80 -g ipvsadm -S #保存 ## 2.2 real server
(1)在每个real server上执行
master1: ifconfig em1:1 172.16.18.13 netmask 255.255.255.0 #配置别名
node1: ifconfig em1:1 172.16.18.13 netmask 255.255.255.0
node2: ifconfig em2:1 172.16.18.13 netmask 255.255.255.0
# 3 其它常用命令
ipvsadm -Ln
ipvsadm -D -t 172.16.18.13:8090 #delete virtual service