- 论坛徽章:
- 0
|
我们开发部开发了一个应用:
端口:TCP/3000,
运行这个应用的有2台服务器,172.16.1.15,172.16.1.16
LVS服务器是172.16.1.12
lvs服务器上的应用策略如下:
[root@CentOS5 lvs]# cat lvs-srv.sh
#!/bin/bash
#
#ADD Virtual IP and route
ifconfig lo:0 172.16.1.8 broadcast 172.16.1.8 netmask 255.255.255.255 up
route add -host 172.16.1.8 dev lo:0
#
ipvsadm -A -t 172.16.1.8:3000 -s wrr
#Add route
ipvsadm -a -t 172.16.1.8:3000 -r 172.16.1.15:3000 -g -w 1
ipvsadm -a -t 172.16.1.8:3000 -r 172.16.1.16:3000 -g -w 1
#Display
ipvsadm -L -n
执行结果如下:
[root@CentOS5 lvs]# ipvsadm -L -n
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress ort Scheduler Flags
-> RemoteAddress ort Forward Weight ActiveConn InActConn
TCP 172.16.1.8:3000 wrr
-> 172.16.1.15:3000 Route 1 0 0
-> 172.16.1.16:3000 Route 1 0 0
[root@CentOS5 lvs]#
真实服务器172.16.1.15,172.16.1.16上的配置如下:
#!/bin/bash
#
ifconfig lo:0 172.16.1.8 broadcast 172.16.1.8 netmask 255.255.255.255 up
route add -host 172.16.1.8 dev lo:0
echo "2" > /proc/sys/net/ipv4/conf/lo/arp_announce
echo "1" > /proc/sys/net/ipv4/conf/all/arp_ignore
echo "2" > /proc/sys/net/ipv4/conf/all/arp_announce
echo "1" > /proc/sys/net/ipv4/conf/lo/arp_ignore
执行结果如下:
[root@8A_3 ~]# ifconfig
eth1 Link encap:Ethernet HWaddr 00:0C:29:A5:4F:60
inet addr:172.16.1.15 Bcast:172.16.1.31 Mask:255.255.255.224
inet6 addr: fe80::20c:29ff:fea5:4f60/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1591413 errors:0 dropped:0 overruns:0 frame:0
TX packets:979509 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:223443500 (213.0 MiB) TX bytes:298755326 (284.9 MiB)
Interrupt:18 Base address:0x2000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1863 errors:0 dropped:0 overruns:0 frame:0
TX packets:1863 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:291238 (284.4 KiB) TX bytes:291238 (284.4 KiB)
lo:0 Link encap:Local Loopback
inet addr:172.16.1.8 Mask:255.255.255.255
UP LOOPBACK RUNNING MTU:16436 Metric:1
[root@8A_3 ~]# netstat -an|grep 3000
tcp 0 0 0.0.0.0:3000 0.0.0.0:* LISTEN
[root@8A_3 ~]#
但是通过客户端连接3000不成功
请问题一下,是什么问题,还有LVS可以处理非WEB应用吗?
谢谢 |
|