用pulse開啟時分流沒有作用,直接用ipvsadm開啟時failover沒有作用(已經解決)

各位大大好,以下是我的環境跟問題,和我自己做的一些測試

環境:
CentOS 5.1
使用Centos 5.1 自帶的 cluster suit

load balancer 192.168.1.3 (有啟動http service, 測試用)
VIP 192.168.1.5
real server 192.168.1.100 - 192.168.1.105 (啟動http 跟 https service)
服務 http 跟 https

我用發現我用service ipvsadm start 時,網頁的確有連到real server的但是這樣的話failover (HA)就沒法完成
如果我用service pulse start 時,failover的確有起來,我從/var/log/messages裡有看到他的確有把我故意關起來的real server停止服務,但是當我用網頁時他並沒有跑到real server裡面,反而是使用load balancer (192.168.1.3)的網頁,但是/var/log/message裡的確有pulse 開啟nanny monitor real server, 和 make real server available 的訊息,但是我用IE開網頁時卻沒有轉到 real server 裡

另外我常常在/var/log/messages裡看到lvs 不能開啟 https 的訊息

請各位大大幫幫我,我弄了好久還是不行,也查過google也沒看到解決方法

______________________________________________________________________________________________________________

今天一早到公司我就趕快把/var/log/messages裡的東西和ifconfig設定抓下來,希望各位大大可以幫幫我,真的很急
/var/log/messages:
Jun 16 08:51:57 lvs avahi-daemon[2365]: Registering HINFO record with values 'X86_64'/'LINUX'.
Jun 16 08:51:58 lvs avahi-daemon[2365]: Server startup complete. Host name is lvs.local. Local service cookie is 908937903.
Jun 16 08:51:59 lvs modclusterd: startup succeeded
Jun 16 08:51:59 lvs oddjobd: oddjobd startup succeeded
Jun 16 08:51:59 lvs avahi-daemon[2365]: Service "SFTP File Transfer on lvs" (/services/sftp-ssh.service) successfully established.
Jun 16 08:51:59 lvs saslauthd[2552]: detach_tty : master pid is: 2552
Jun 16 08:51:59 lvs saslauthd[2552]: ipc_init : listening on socket: /var/run/saslauthd/mux
Jun 16 08:51:59 lvs ricci: startup succeeded
Jun 16 08:52:00 lvs smartd[2580]: smartd version 5.36 [x86_64-redhat-linux-gnu] Copyright (C) 2002-6 Bruce Allen
Jun 16 08:52:00 lvs smartd[2580]: Home page is http://smartmontools.sourceforge.net/
Jun 16 08:52:00 lvs smartd[2580]: Opened configuration file /etc/smartd.conf
Jun 16 08:52:00 lvs smartd[2580]: Configuration file /etc/smartd.conf parsed but has no entries (like /dev/hda)
Jun 16 08:52:00 lvs smartd[2580]: Monitoring 0 ATA and 0 SCSI devices
Jun 16 08:52:00 lvs smartd[2582]: smartd has fork()ed into background mode. New PID=2582.
Jun 16 08:52:05 lvs pulse[2209]: partner dead: activating lvs
Jun 16 08:52:05 lvs avahi-daemon[2365]: Withdrawing address record for 192.168.1.5 on eth0.
Jun 16 08:52:05 lvs avahi-daemon[2365]: Leaving mDNS multicast group on interface eth0.IPv4 with address 192.168.1.5.
Jun 16 08:52:05 lvs avahi-daemon[2365]: Joining mDNS multicast group on interface eth0.IPv4 with address 192.168.1.3.
Jun 16 08:52:05 lvs avahi-daemon[2365]: Registering new address record for 192.168.1.5 on eth0.
Jun 16 08:52:05 lvs lvs[2642]: starting virtual service http active: 80
Jun 16 08:52:05 lvs lvs[2642]: create_monitor for http/node0 running as pid 2651
Jun 16 08:52:05 lvs lvs[2642]: create_monitor for http/node1 running as pid 2652
Jun 16 08:52:05 lvs lvs[2642]: create_monitor for http/node2 running as pid 2653
Jun 16 08:52:05 lvs lvs[2642]: create_monitor for http/node3 running as pid 2654
Jun 16 08:52:05 lvs lvs[2642]: create_monitor for http/node4 running as pid 2655
Jun 16 08:52:05 lvs lvs[2642]: create_monitor for http/node5 running as pid 2656
Jun 16 08:52:05 lvs lvs[2642]: starting virtual service https active: 443
Jun 16 08:52:05 lvs lvs[2642]: ipvsadm failed for virtual server https!
Jun 16 08:52:05 lvs kernel: send_arp uses obsolete (PF_INET,SOCK_PACKET)
Jun 16 08:52:05 lvs nanny[2652]: starting LVS client monitor for 192.168.1.5:80
Jun 16 08:52:05 lvs nanny[2654]: starting LVS client monitor for 192.168.1.5:80
Jun 16 08:52:05 lvs nanny[2653]: starting LVS client monitor for 192.168.1.5:80
Jun 16 08:52:05 lvs nanny[2655]: starting LVS client monitor for 192.168.1.5:80
Jun 16 08:52:05 lvs nanny[2656]: starting LVS client monitor for 192.168.1.5:80
Jun 16 08:52:05 lvs nanny[2651]: starting LVS client monitor for 192.168.1.5:80
Jun 16 08:52:07 lvs kernel: tg3: eth0: Link is up at 1000 Mbps, full duplex.
Jun 16 08:52:07 lvs kernel: tg3: eth0: Flow control is on for TX and on for RX.
Jun 16 08:52:07 lvs kernel: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Jun 16 08:52:08 lvs avahi-daemon[2365]: New relevant interface eth0.IPv6 for mDNS.
Jun 16 08:52:08 lvs avahi-daemon[2365]: Joining mDNS multicast group on interface eth0.IPv6 with address fe80::2e0:81ff:fe2d:e9d2.
Jun 16 08:52:08 lvs avahi-daemon[2365]: Registering new address record for fe80::2e0:81ff:fe2d:e9d2 on eth0.
Jun 16 08:52:10 lvs pulse[2644]: gratuitous lvs arps finished
Jun 16 09:04:03 lvs nanny[2652]: making 192.168.1.101:80 available
Jun 16 09:04:06 lvs nanny[2654]: making 192.168.1.103:80 available
Jun 16 09:04:06 lvs nanny[2653]: making 192.168.1.102:80 available
Jun 16 09:04:06 lvs nanny[2655]: making 192.168.1.104:80 available
Jun 16 09:04:06 lvs nanny[2651]: making 192.168.1.100:80 available
Jun 16 09:04:14 lvs nanny[2656]: making 192.168.1.105:80 available

ifconfig:
eth0 Link encap:Ethernet HWaddr 00:E0:81:2D:E9:D2
inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::2e0:81ff:fe2d:e9d2/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2832 errors:0 dropped:0 overruns:0 frame:0
TX packets:4842 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2027739 (1.9 MiB) TX bytes:365827 (357.2 KiB)
Interrupt:17

eth0:1 Link encap:Ethernet HWaddr 00:E0:81:2D:E9:D2
inet addr:192.168.1.5 Bcast:192.168.1.5 Mask:255.255.255.255
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:17

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:1575 errors:0 dropped:0 overruns:0 frame:0
TX packets:1575 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:150952 (147.4 KiB) TX bytes:150952 (147.4 KiB)

________________________________________________________________________________________________________

各位大大,我今天已經把問題解決了,現在說一下怎麼解決,好讓跟我有問題的人能找到答案

其實是我少寫了對iptables的設定,因為我有http和https service,所以我需要做multiport,但是因為設定完沒有儲存起來所以從該iptables時就會照成無法把request送到real server的問題

只要加入下列的動作問題就解決了

/sbin/iptables -t mangle -A PREROUTING -p tcp -d 192.168.1.5/32 --dport 80 -j MARK --set-mark 80
/sbin/iptables -t mangle -A PREROUTING -p tcp -d 192.168.1.5/32 --dport 443 -j MARK --set-mark 80
service iptbales save
service iptables start

雖然各位大大還沒來的及幫我,但我還是很謝謝各位.

^_^

Forums:

randomness