紅帽圖形化安裝LVS 檢測不到真實主機狀態 急急急!!

火星人 @ 2014-03-04 , reply:0


紅帽圖形化安裝LVS 檢測不到真實主機狀態 急急急!!

我通過紅帽5.4的piranha 圖形化工具配置LVS  採用DR模式   其中192.168.1.110 和192.168.1.111是真實主機的IP地址   VIP是192.168.1.200
192.168.1.100主機是LVS的主程序所在主機     
具體的lvs.cf配置文件如下
# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:F3:97:32  
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fef3:9732/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4683 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4046 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:460651 (449.8 KiB)  TX bytes:774814 (756.6 KiB)
          Interrupt:75 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:6499 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6499 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:9953524 (9.4 MiB)  TX bytes:9953524 (9.4 MiB)

# cat /etc/sysconfig/ha/lvs.cf
serial_no = 37
primary = 192.168.1.100
primary_private = 192.168.1.100
service = lvs
backup_active = 1
backup = 192.168.1.101
heartbeat = 1
heartbeat_port = 539
keepalive = 6
deadtime = 18
network = direct
debug_level = NONE
monitor_links = 0
syncdaemon = 0
virtual test_web {
     active = 1
     address = 192.168.1.200 eth0:1
     vip_nmask = 255.255.255.255
     port = 80
     send = "GET / HTTP/1.0\r\n\r\n"
     expect = "HTTP"
     use_regex = 0
     load_monitor = none
     scheduler = rr
     protocol = tcp
     timeout = 6
     reentry = 15
     quiesce_server = 0
     server RS1 {
         address = 192.168.1.110
         active = 1
         weight = 1
     }
     server RS2 {
         address = 192.168.1.111
         active = 1
         weight = 1
     }

######################################
在真實伺服器上執行了的腳本內容如下
# cat startlvs.sh
#!/bin/bash
#description : start realserver
VIP=192.168.1.200
/etc/rc.d/init.d/functions
case "$1" in
start)
echo " start LVS of REALServer"
/sbin/ifconfig lo:0 $VIP broadcast $VIP netmask 255.255.255.255 up
/sbin/route add -host $VIP dev lo:0
echo "1" >/proc/sys/net/ipv4/conf/lo/arp_ignore
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
sysctl -p >/dev/null 2>&1
;;
stop)
/sbin/ifconfig lo:0 down
echo "close LVS Directorserver"
echo "0" >/proc/sys/net/ipv4/conf/lo/arp_ignore
echo "0" >/proc/sys/net/ipv4/conf/lo/arp_announce
echo "0" >/proc/sys/net/ipv4/conf/all/arp_ignore
echo "0" >/proc/sys/net/ipv4/conf/all/arp_announce
sysctl -p >/dev/null 2>&1
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
#######################################
通過service pulse start 命令啟動LVS后缺發現檢測不到真實主機的情況
# ipvsadm
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
  -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
#

ipvsadm是空的   重裝了好幾次都是這樣  請大家幫忙看看  是我哪裡配置的不對,謝謝大家
《解決方案》

貼出日誌信息

192.168.1.110
192.168.1.111

的80埠都是正常的嗎
《解決方案》

這兩個IP地址80埠都是正常  主要的問題就是在AR主機上用ipvsadm命令看不到路由表  很奇怪
# netstat -anltp|grep 80
tcp        0      0 :::80                       :::*                        LISTEN      3287/httpd         
tcp        0      0 :::22                       :::*                        LISTEN      2808/sshd           
# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:BA:C0:7D  
          inet addr:192.168.1.110  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:feba:c07d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8991 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5742 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:708564 (691.9 KiB)  TX bytes:744309 (726.8 KiB)
          Interrupt:75 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:6759 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6759 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:11268246 (10.7 MiB)  TX bytes:11268246 (10.7 MiB)

lo:0      Link encap:Local Loopback  
          inet addr:192.168.1.200  Mask:255.255.255.255
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
###################################################
# netstat -anltp|grep 80
tcp        0      0 :::80                       :::*                        LISTEN      3287/httpd         
tcp        0      0 :::22                       :::*                        LISTEN      2807/sshd           
# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:FE:2F:A1  
          inet addr:192.168.1.111  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fefe:2fa1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8662 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5494 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:672929 (657.1 KiB)  TX bytes:718654 (701.8 KiB)
          Interrupt:75 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:6747 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6747 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:11279330 (10.7 MiB)  TX bytes:11279330 (10.7 MiB)

lo:0      Link encap:Local Loopback  
          inet addr:192.168.1.200  Mask:255.255.255.255
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
《解決方案》

要哪裡的日誌信息???  /var/log/message的嗎?
# tail -100 /var/log/messages
Apr  5 15:52:49 AR automount: lookup_read_master: lookup(nisplus): couldn't locate nis+ table auto.master
Apr  5 15:52:50 AR xinetd: xinetd Version 2.3.14 started with libwrap loadavg labeled-networking options compiled in.
Apr  5 15:52:50 AR xinetd: Started working: 0 available services
Apr  5 15:55:56 AR gpm: *** info :
Apr  5 15:55:56 AR gpm: Started gpm successfully. Entered daemon mode.
Apr  5 15:55:59 AR avahi-daemon: Found user 'avahi' (UID 70) and group 'avahi' (GID 70).
Apr  5 15:55:59 AR avahi-daemon: Successfully dropped root privileges.
Apr  5 15:55:59 AR avahi-daemon: avahi-daemon 0.6.16 starting up.
Apr  5 15:55:59 AR avahi-daemon: WARNING: No NSS support for mDNS detected, consider installing nss-mdns!
Apr  5 15:55:59 AR avahi-daemon: Successfully called chroot().
Apr  5 15:55:59 AR avahi-daemon: Successfully dropped remaining capabilities.
Apr  5 15:55:59 AR avahi-daemon: Loading service file /services/sftp-ssh.service.
Apr  5 15:55:59 AR avahi-daemon: New relevant interface eth0.IPv6 for mDNS.
Apr  5 15:55:59 AR avahi-daemon: Joining mDNS multicast group on interface eth0.IPv6 with address fe80::20c:29ff:fef3:9732.
Apr  5 15:55:59 AR avahi-daemon: New relevant interface eth0.IPv4 for mDNS.
Apr  5 15:55:59 AR avahi-daemon: Joining mDNS multicast group on interface eth0.IPv4 with address 192.168.1.100.
Apr  5 15:55:59 AR avahi-daemon: Network interface enumeration completed.
Apr  5 15:55:59 AR avahi-daemon: Registering new address record for fe80::20c:29ff:fef3:9732 on eth0.
Apr  5 15:55:59 AR avahi-daemon: Registering new address record for 192.168.1.100 on eth0.
Apr  5 15:55:59 AR avahi-daemon: Registering HINFO record with values 'I686'/'LINUX'.
Apr  5 15:56:00 AR avahi-daemon: Server startup complete. Host name is AR.local. Local service cookie is 3191555070.
Apr  5 15:56:00 AR smartd: smartd version 5.38 Copyright (C) 2002-8 Bruce Allen
Apr  5 15:56:00 AR smartd: Home page is http://smartmontools.sourceforge.net/  
Apr  5 15:56:00 AR smartd: Opened configuration file /etc/smartd.conf
Apr  5 15:56:00 AR smartd: Configuration file /etc/smartd.conf was parsed, found DEVICESCAN, scanning devices
Apr  5 15:56:00 AR smartd: Device: /dev/hdc, opened
Apr  5 15:56:00 AR kernel: hdc: drive_cmd: status=0x51 { DriveReady SeekComplete Error }
Apr  5 15:56:00 AR kernel: hdc: drive_cmd: error=0x04 { AbortedCommand }
Apr  5 15:56:00 AR kernel: ide: failed opcode was: 0xec
Apr  5 15:56:00 AR smartd: Device: /dev/hdc, not ATA, no IDENTIFY DEVICE Structure
Apr  5 15:56:00 AR smartd: Device: /dev/sda, opened
Apr  5 15:56:00 AR smartd: Device: /dev/sda, IE (SMART) not enabled, skip device Try 'smartctl -s on /dev/sda' to turn on SMART features
Apr  5 15:56:00 AR smartd: Monitoring 0 ATA and 0 SCSI devices
Apr  5 15:56:00 AR smartd: smartd has fork()ed into background mode. New PID=3023.
Apr  5 15:56:01 AR avahi-daemon: Service "SFTP File Transfer on AR" (/services/sftp-ssh.service) successfully established.
Apr  5 15:56:05 AR pcscd: winscard.c:304:SCardConnect() Reader E-Gate 0 0 Not Found
Apr  5 15:56:05 AR last message repeated 3 times
Apr  5 15:56:32 AR gconfd (root-3231): starting (version 2.14.0), pid 3231 user 'root'
Apr  5 15:56:33 AR gconfd (root-3231): Resolved address "xml:readonly:/etc/gconf/gconf.xml.mandatory" to a read-only configuration source at position 0
Apr  5 15:56:33 AR gconfd (root-3231): Resolved address "xml:readwrite:/root/.gconf" to a writable configuration source at position 1
Apr  5 15:56:33 AR gconfd (root-3231): Resolved address "xml:readonly:/etc/gconf/gconf.xml.defaults" to a read-only configuration source at position 2
Apr  5 15:56:36 AR gconfd (root-3231): Resolved address "xml:readwrite:/root/.gconf" to a writable configuration source at position 0
Apr  5 15:56:37 AR hcid: Default passkey agent (:1.8, /org/bluez/applet) registered
Apr  5 15:56:37 AR hald: mounted /dev/hdc on behalf of uid 0
Apr  5 15:56:38 AR pcscd: winscard.c:304:SCardConnect() Reader E-Gate 0 0 Not Found
Apr  5 15:56:38 AR last message repeated 2 times
Apr  5 15:56:39 AR nm-system-settings: Loaded plugin ifcfg-rh: (c) 2007 - 2008 Red Hat, Inc.  To report bugs please use the NetworkManager mailing list.
Apr  5 15:56:40 AR nm-system-settings:    ifcfg-rh: parsing /etc/sysconfig/network-scripts/ifcfg-lo ...
Apr  5 15:56:40 AR nm-system-settings:    ifcfg-rh: parsing /etc/sysconfig/network-scripts/ifcfg-eth0 ...
Apr  5 15:56:40 AR nm-system-settings:    ifcfg-rh:     read connection 'System eth0'
Apr  5 15:56:41 AR pcscd: winscard.c:304:SCardConnect() Reader E-Gate 0 0 Not Found
Apr  5 15:58:08 AR avahi-daemon: Invalid query packet.
Apr  5 15:58:49 AR last message repeated 7 times
Apr  5 16:33:13 AR pulse: STARTING PULSE AS MASTER
Apr  5 16:33:31 AR pulse: partner dead: activating lvs
Apr  5 16:33:31 AR avahi-daemon: Registering new address record for 192.168.1.200 on eth0.
Apr  5 16:33:31 AR kernel: send_arp uses obsolete (PF_INET,SOCK_PACKET)
Apr  5 16:33:31 AR kernel: IPVS: Registered protocols (TCP, UDP, AH, ESP)
Apr  5 16:33:31 AR kernel: IPVS: Connection hash table configured (size=4096, memory=32Kbytes)
Apr  5 16:33:31 AR kernel: IPVS: ipvs loaded.
Apr  5 16:33:31 AR lvs: starting virtual service test_web active: 80
Apr  5 16:33:31 AR kernel: IPVS: scheduler registered.
Apr  5 16:33:31 AR nanny: starting LVS client monitor for 192.168.1.200:80 -> 192.168.1.110:80
Apr  5 16:33:31 AR lvs: create_monitor for test_web/RS1 running as pid 3630
Apr  5 16:33:31 AR lvs: create_monitor for test_web/RS2 running as pid 3631
Apr  5 16:33:31 AR nanny: starting LVS client monitor for 192.168.1.200:80 -> 192.168.1.111:80
Apr  5 16:33:36 AR pulse: gratuitous lvs arps finished
Apr  5 16:35:25 AR nanny: [ active ] making 192.168.1.110:80 available
Apr  5 16:35:31 AR nanny: [ active ] making 192.168.1.111:80 available
Apr  5 16:38:13 AR nanny: CONNECT to 192.168.1.111:80 timed out
Apr  5 16:38:13 AR nanny: shutting down 192.168.1.111:80 due to connection failure
Apr  5 16:38:19 AR nanny: CONNECT to 192.168.1.110:80 timed out
Apr  5 16:38:19 AR nanny: shutting down 192.168.1.110:80 due to connection failure
Apr  5 16:38:26 AR nanny: CONNECT to 192.168.1.111:80 timed out
Apr  5 16:38:31 AR nanny: CONNECT to 192.168.1.110:80 timed out
Apr  5 16:38:38 AR nanny: CONNECT to 192.168.1.111:80 timed out
Apr  5 16:38:38 AR pulse: Terminating due to signal 15
Apr  5 16:38:38 AR lvs: shutting down due to signal 15
Apr  5 16:38:38 AR lvs: shutting down virtual service test_web
Apr  5 16:38:38 AR avahi-daemon: Withdrawing address record for 192.168.1.200 on eth0.
Apr  5 16:38:38 AR pulse: STARTING PULSE AS MASTER
Apr  5 16:38:43 AR nanny: CONNECT to 192.168.1.110:80 timed out
Apr  5 16:47:39 AR avahi-daemon: Invalid query packet.
Apr  5 16:48:19 AR last message repeated 7 times
Apr  5 16:50:05 AR nanny: CONNECT to 192.168.1.110:80 timed out
Apr  5 16:50:18 AR nanny: CONNECT to 192.168.1.111:80 timed out
Apr  5 16:52:32 AR nanny: CONNECT to 192.168.1.110:80 timed out
Apr  5 16:52:51 AR nanny: CONNECT to 192.168.1.110:80 timed out
Apr  5 16:53:03 AR nanny: [ active ] making 192.168.1.111:80 available
Apr  5 16:53:03 AR nanny: /sbin/ipvsadm command failed!
Apr  5 16:53:03 AR nanny: CONNECT to 192.168.1.110:80 timed out
Apr  5 16:53:43 AR nanny: [ active ] making 192.168.1.110:80 available
Apr  5 16:53:43 AR nanny: /sbin/ipvsadm command failed!
Apr  5 17:04:45 AR init: Trying to re-exec init
Apr  5 17:12:19 AR pulse: Terminating due to signal 15
Apr  5 17:12:59 AR pulse: STARTING PULSE AS MASTER
Apr  5 17:27:05 AR pulse: Terminating due to signal 15
Apr  5 17:27:05 AR pulse: STARTING PULSE AS MASTER
Apr  5 17:27:09 AR pulse: Terminating due to signal 15
Apr  5 17:27:09 AR pulse: STARTING PULSE AS MASTER
《解決方案》

找到一些錯誤日誌  一直顯示111和110主機的80埠timeout  但是我剛才從AR主機上telnet 這兩個主機的80埠沒問題  另外這兩個主機的iptables和selinux都已經關閉了。還有那些地方需要設置呢?
Apr  5 16:38:13 AR nanny: CONNECT to 192.168.1.111:80 timed out
Apr  5 16:38:13 AR nanny: shutting down 192.168.1.111:80 due to connection failure
Apr  5 16:38:19 AR nanny: CONNECT to 192.168.1.110:80 timed out
Apr  5 16:38:19 AR nanny: shutting down 192.168.1.110:80 due to connection failure
《解決方案》

現在經過測試發現LVS已經開始工作了 通過WEB頁面訪問192.168.1.200這個虛擬IP已經可輪詢真實主機的WEB界面了,在AR主機上用命令ipvsadm查看LVS狀態還是空的

CURRENT LVS ROUTING TABLE
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn

這是怎麼回事啊。。。太詭異了
回復 2# 南非螞蟻


   
《解決方案》

問題已經解決了,我自己還配置了一個AR主機192.168.1.100的冗餘BR主機192.168.1.101   LVS自己切換的到BR主機上去了而我一直在AR主機上用ipvsadm查看當然啥都看不出來了,呵呵。在BR主機上就能看到正確的連接表。
《解決方案》

:lol:lol

恭喜啊




[火星人 via ] 紅帽圖形化安裝LVS 檢測不到真實主機狀態 急急急!!已經有214次圍觀

http://www.coctec.com/docs/service/show-post-4615.html