找回密码
 注册
楼主: lues

ipvs的问题

[复制链接]
 楼主| 发表于 2004-10-29 23:32:38 | 显示全部楼层
dannycat,我可一直在等你呀,你做LVS用的是mon还是ldirectord呀
回复

使用道具 举报

发表于 2004-10-30 09:27:15 | 显示全部楼层
To lues: 这两天感冒头晕,基本上没有到公社来。

[quote:826b5ac095="lues"]但我的/etc/ha.d/haresources 已经写了
test3 IPaddr::210.75.11.37 ipvsadm ldirectord::www
为什么ldirectord没有启动呢?[/quote]

如果不是使用24位的掩码, /etc/ha.d/resources.d/IPaddr 脚本需要的IP地址参数要指定子网位数甚至网卡、广播地址,像这样的:
  IP地址/子网位数/广播地址

否则你只写一个 210.75.11.37 它启动不起来。
回复

使用道具 举报

 楼主| 发表于 2004-10-31 08:37:40 | 显示全部楼层
多谢指引,我星期一马上试试
回复

使用道具 举报

 楼主| 发表于 2004-11-1 11:40:09 | 显示全部楼层
,我试了一下不行, ldirectord还是没有启动
我的LVS服务器:210.75.11.38
我的Real Server: 210.75.11.34
                           210.75.11.36


LVS服务器配置(采用LVS/DR模式)

more haresources
test9   IPaddr::210.75.11.37/29/210.75.11.39    ipvsadm ldirectord::www

more www.cf
checktimeout=3
checkinterval=1
fallback=127.0.0.1:80
autoreload=yes
#logfile="/var/log/ldirectord.log"
#logfile="local0"
quiescent=yes

# A sample virual with a fallback that will override the gobal setting
virtual=210.75.11.37:80
        real=210.75.11.34:80 gate
        real=210.75.11.36:80 gate
#       real=210.75.11.6:80 gate
        fallback=127.0.0.1:80 gate
        service=http
#       request="index.html"
        request=".testpage"
        receive="Test Page"
#       virtualhost=some.domain.com.au
        scheduler=wlc
        #persistent=600
        #netmask=255.255.255.255
        protocol=tcp
我的ldirectord.cf是按照系统默认的,没有修改过

[root@test7 ha.d]# service ldirectord status
ldirectord is stopped for /etc/ha.d/ldirectord.cf

[root@test7 ha.d]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:E0:18:D0:21:D3  
          inet addr:210.75.11.38  Bcast:210.75.11.39  Mask:255.255.255.248

eth0:0    Link encap:Ethernet  HWaddr 00:E0:18:D0:21:D3  
          inet addr:210.75.11.37  Bcast:210.75.11.39  Mask:255.255.255.248
           
eth1      Link encap:Ethernet  HWaddr 00:E0:4C:77:25:AC  
          inet addr:10.0.0.7  Bcast:10.255.255.255  Mask:255.0.0.0
           
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0


service ipvsadm status
IP Virtual Server version 1.0.8 (size=65536)
Prot LocalAddressort Scheduler Flags
  -> RemoteAddressort           Forward Weight ActiveConn InActConn
TCP  210.75.11.37:80 wlc
  -> 210.75.11.34:80              Route   1      0          2         
  -> 210.75.11.36:80              Route   1      0          2     


然后我down掉210.75.11.34的http服务,LVS服务器并没有自动删除其路由
回复

使用道具 举报

发表于 2004-11-1 13:09:30 | 显示全部楼层
你的 ha.cf 是前面那个吗?怎么没有指定 bcast 接口?
日志里有相关记录吗?
回复

使用道具 举报

 楼主| 发表于 2004-11-1 13:19:36 | 显示全部楼层
[quote:c8606f6cf2="dannycat"]你的 ha.cf 是前面那个吗?怎么没有指定 bcast 接口?
日志里有相关记录吗?[/quote]
我的ha.cf确实没有指定bcast 接口,因为我发现udp 694就可以作为心跳线

我的ldirectord.log 如下

[root@test7 ha.d]# tail /var/log/ldirectord.log
[Mon Nov  1 12:54:20 2004|www] Config file www not found
[Mon Nov  1 12:54:20 2004|www] Exiting with exit_status 1: Initialisation Error
[Mon Nov  1 12:54:22 2004|www] Config file www not found
[Mon Nov  1 12:54:22 2004|www] Exiting with exit_status 1: Initialisation Error
[Mon Nov  1 12:54:23 2004|www] Config file www not found
[Mon Nov  1 12:54:23 2004|www] Exiting with exit_status 1: Initialisation Error
[Mon Nov  1 12:54:24 2004|www] Config file www not found
[Mon Nov  1 12:54:24 2004|www] Exiting with exit_status 1: Initialisation Error
[Mon Nov  1 12:54:25 2004|www] Config file www not found
[Mon Nov  1 12:54:25 2004|www] Exiting with exit_status 1: Initialisation Error

我的现在的ha.cf如下

debugfile /var/log/ha-debug
logfile /var/log/ha-log   
node test7               
node test9               
keepalive 2               
deadtime 20               
initdead 240              
udp eth1                  
udpport 694

我觉得奇怪,为什么会说Config file www not found

[root@test7 root]# cd /etc/ha.d
[root@test7 ha.d]# ls
authkeys  conf  ha.cf  harc  haresources  ldirectord.cf  rc.d  README.config  resource.d  shellfuncs  www.cf


此外,版主你的感冒好了吗?这么快就上来了
回复

使用道具 举报

 楼主| 发表于 2004-11-1 13:27:18 | 显示全部楼层
[root@test7 ha.d]# tail -f /var/log/ha-log
heartbeat: 2004/11/01_13:10:29 info: Running /etc/ha.d/rc.d/status status
heartbeat: 2004/11/01_13:10:29 info: No local resources [/usr/lib/heartbeat/ResourceManager listkeys test7] to acquire.
heartbeat: 2004/11/01_13:10:29 info: Taking over resource group IPaddr::210.75.11.37/32/210.75.11.39
heartbeat: 2004/11/01_13:10:29 info: Acquiring resource group: test9 IPaddr::210.75.11.37/32/210.75.11.39 ipvsadm ldirectord::www
heartbeat: 2004/11/01_13:10:29 info: Running /etc/init.d/ipvsadm  start
heartbeat: 2004/11/01_13:10:29 info: Running /etc/ha.d/resource.d/ldirectord www start
heartbeat: 2004/11/01_13:10:30 ERROR: Return code 1 from /etc/ha.d/resource.d/ldirectord
heartbeat: 2004/11/01_13:10:30 info: /usr/lib/heartbeat/mach_down: nice_failback: foreign resources acquired
heartbeat: 2004/11/01_13:10:30 info: mach_down takeover complete.
heartbeat: 2004/11/01_13:10:30 info: mach_down takeover complete for node test9.

从日志看ldirectord www 已经启动了,只是www.cf配置文件系统没有找到
回复

使用道具 举报

发表于 2004-11-1 13:48:08 | 显示全部楼层
[quote:175d097346="lues"]udp eth1 [/quote]
是 bcast eth1 吧? 好象可以不要,不过还是加上的好,省得数据包乱发   没有仔细研究过,乱说的~~

呵呵,把 www.cf 改名成 www。

感冒好多了,只剩下嗓子还不好。多谢关心! 上班去了。
回复

使用道具 举报

 楼主| 发表于 2004-11-1 13:52:57 | 显示全部楼层
呵呵,现在要去机房了,回来马上试一把
回复

使用道具 举报

 楼主| 发表于 2004-11-1 17:59:33 | 显示全部楼层
我现在在机房忙里偷闲将www.cf改为了www,启动以后没有Config file www not found 错误提示了,但是出现了 Exiting with exit_status 1: Initialisation Error,是不是我www的语法还是有错?
现在我的34服务器down掉了,但是ldirectord还是没有自动删除34的路由,

[root@test7 root]# service ipvsadm status
IP Virtual Server version 1.0.8 (size=65536)
Prot LocalAddressort Scheduler Flags
  -> RemoteAddressort           Forward Weight ActiveConn InActConn
TCP  210.75.11.37:80 wlc
  -> 210.75.11.34:80              Route   1      0          0         
  -> 210.75.11.36:80              Route   1      0          0        

tail -f /var/log/ldirectord.log

[Mon Nov  1 17:39:38 2004|www] Starting Linux Director v1.85 as daemon
[Mon Nov  1 17:39:38 2004|www] Changed virtual server: 210.75.11.37:80
[Mon Nov  1 17:39:38 2004|www] Changed real server: 210.75.11.34:80 (1 x 210.75.11.37:80)
[Mon Nov  1 17:39:38 2004|www] Changed real server: 210.75.11.36:80 (2 x 210.75.11.37:80)
[Mon Nov  1 17:39:41 2004|www] Quiescent real server: 210.75.11.34:80 (2 x 210.75.11.37:80) (Weight set to 0)
[Mon Nov  1 17:39:41 2004|www] Restored real server: 210.75.11.36:80 (1 x 210.75.11.37:80) (Weight set to 1)
[Mon Nov  1 17:39:59 2004|www] ldirectord for /etc/ha.d/www is already running with pid: 5879
[Mon Nov  1 17:39:59 2004|www] Exiting with exit_status 1: Initialisation Error

tail -f /var/log/ha-log  

heartbeat: 2004/11/01_17:39:37 info: Received shutdown notice from 'test9'.
heartbeat: 2004/11/01_17:39:37 info: Resources being acquired from test9.
heartbeat: 2004/11/01_17:39:37 info: Running /etc/ha.d/rc.d/status status
heartbeat: 2004/11/01_17:39:37 info: No local resources [/usr/lib/heartbeat/ResourceManager listkeys test7] to acquire.
heartbeat: 2004/11/01_17:39:37 info: Taking over resource group IPaddr::210.75.11.37/32/210.75.11.39
heartbeat: 2004/11/01_17:39:37 info: Acquiring resource group: test9 IPaddr::210.75.11.37/32/210.75.11.39 ipvsadm ldirectord::www
heartbeat: 2004/11/01_17:39:37 info: Running /etc/ha.d/resource.d/IPaddr 210.75.11.37/32/210.75.11.39 start
heartbeat: 2004/11/01_17:39:37 info: /sbin/ifconfig eth0:0 210.75.11.37  netmask 255.255.255.255        broadcast 210.75.11.39
heartbeat: 2004/11/01_17:39:37 info: Sending Gratuitous Arp for 210.75.11.37 on eth0:0 [eth0]
heartbeat: 2004/11/01_17:39:37 /usr/lib/heartbeat/send_arp -i 500 -r 10 -p /var/lib/heartbeat/rsctmp/send_arp/send_arp-210.75.11.37 eth0 210.75.11.37 auto 210.75.11.37 ffffffffffff
heartbeat: 2004/11/01_17:39:37 info: Running /etc/init.d/ipvsadm  start
heartbeat: 2004/11/01_17:39:37 info: Running /etc/ha.d/resource.d/ldirectord www start
heartbeat: 2004/11/01_17:39:38 info: /usr/lib/heartbeat/mach_down: nice_failback: foreign resources acquired
heartbeat: 2004/11/01_17:39:38 info: mach_down takeover complete.
heartbeat: 2004/11/01_17:39:38 info: mach_down takeover complete for node test9.
heartbeat: 2004/11/01_17:39:58 WARN: node test9: is dead
heartbeat: 2004/11/01_17:39:58 info: Dead node test9 held no resources.
heartbeat: 2004/11/01_17:39:58 info: Resources being acquired from test9.
heartbeat: 2004/11/01_17:39:58 info: Link test9:eth1 dead.
heartbeat: 2004/11/01_17:39:58 info: Running /etc/ha.d/rc.d/status status
heartbeat: 2004/11/01_17:39:58 info: No local resources [/usr/lib/heartbeat/ResourceManager listkeys test7] to acquire.
heartbeat: 2004/11/01_17:39:58 info: Taking over resource group IPaddr::210.75.11.37/32/210.75.11.39
heartbeat: 2004/11/01_17:39:58 info: Acquiring resource group: test9 IPaddr::210.75.11.37/32/210.75.11.39 ipvsadm ldirectord::www
heartbeat: 2004/11/01_17:39:58 info: Running /etc/init.d/ipvsadm  start
heartbeat: 2004/11/01_17:39:59 info: Running /etc/ha.d/resource.d/ldirectord www start
heartbeat: 2004/11/01_17:39:59 ERROR: Return code 1 from /etc/ha.d/resource.d/ldirectord
heartbeat: 2004/11/01_17:39:59 info: /usr/lib/heartbeat/mach_down: nice_failback: foreign resources acquired
heartbeat: 2004/11/01_17:39:59 info: mach_down takeover complete.
heartbeat: 2004/11/01_17:39:59 info: mach_down takeover complete for node test9.
回复

使用道具 举报

发表于 2004-11-1 21:04:14 | 显示全部楼层
[quote:999ba0849d="lues"]heartbeat: 2004/11/01_17:39:37 info: Taking over resource group IPaddr::210.75.11.37/32/210.75.11.39 [/quote]
子网位数 32 ?

info: mach_down takeover complete for node test9.

这个应该是工作了。

你直接运行 /etc/ha.d/resource.d/ldirectord www start 看看有什么反应。

两年前做过,现在没有环境搞 LVS,都忘记了
回复

使用道具 举报

 楼主| 发表于 2004-11-2 09:31:02 | 显示全部楼层
[quote:21ee728e1c="dannycat"]子网位数 32 ?

[/quote]

我看文章说用LVS/DR模式VIP的子网位数是32 ,我原来设的是29,但不管子网掩码是多少,LVS都能正确路由

[quote:21ee728e1c="dannycat"]你直接运行 /etc/ha.d/resource.d/ldirectord www start 看看有什么反应。

[/quote]

[root@test7 root]# /etc/ha.d/resource.d/ldirectord www start
ldirectord for /etc/ha.d/www is already running with pid: 5879

[root@test7 root]# tail -f /var/log/ldirectord.log
[Tue Nov  2 09:21:54 2004|www] ldirectord for /etc/ha.d/www is already running with pid: 5879
[Tue Nov  2 09:21:54 2004|www] Exiting with exit_status 1: Initialisation Error

[quote:21ee728e1c="dannycat"]两年前做过,现在没有环境搞 LVS,都忘记了

[/quote]

如果你愿意登陆,我可以把我的帐号密码发给你
回复

使用道具 举报

 楼主| 发表于 2004-11-2 09:45:34 | 显示全部楼层
我又把www拷贝为www.cf试了一把

[root@test7 ha.d]# /etc/ha.d/resource.d/ldirectord www.cf start
[root@test7 ha.d]# /etc/ha.d/resource.d/ldirectord www.cf start
ldirectord for /etc/ha.d/www.cf is already running with pid: 7797

tail -f /var/log/ldirectord.log

[Tue Nov  2 09:38:30 2004|www.cf] ldirectord for /etc/ha.d/www.cf is already running with pid: 7797
[Tue Nov  2 09:38:30 2004|www.cf] Exiting with exit_status 1: Initialisation Error
回复

使用道具 举报

 楼主| 发表于 2004-11-2 15:14:40 | 显示全部楼层
版主,好消息,有突破性进展,

        

我把www.cf拷贝为ldirectord.cf,再将haresources 改为了
test9 IPaddr::210.75.11.37/29/210.75.11.39 ipvsadm ldirectord
然后重启了服务器

[root@test7 root]# tail -f /var/log/ha-log
heartbeat: 2004/11/02_14:45:14 info: Configuration validated. Starting heartbeat 1.3.0
heartbeat: 2004/11/02_14:45:14 info: heartbeat: version 1.3.0
heartbeat: 2004/11/02_14:45:14 info: Heartbeat generation: 68
heartbeat: 2004/11/02_14:45:15 info: UDP Broadcast heartbeat started on port 694 (694) interface eth1
heartbeat: 2004/11/02_14:45:15 info: pid 3834 locked in memory.
heartbeat: 2004/11/02_14:45:15 info: Local status now set to: 'up'
heartbeat: 2004/11/02_14:45:16 info: pid 3847 locked in memory.
heartbeat: 2004/11/02_14:45:16 info: pid 3848 locked in memory.
heartbeat: 2004/11/02_14:45:16 info: pid 3849 locked in memory.
heartbeat: 2004/11/02_14:45:16 info: Link test7:eth1 up.
heartbeat: 2004/11/02_14:49:15 WARN: node test9: is dead
heartbeat: 2004/11/02_14:49:15 info: Local status now set to: 'active'
heartbeat: 2004/11/02_14:49:15 WARN: No STONITH device configured.
heartbeat: 2004/11/02_14:49:15 WARN: Shared disks are not protected.
heartbeat: 2004/11/02_14:49:15 info: Resources being acquired from test9.
heartbeat: 2004/11/02_14:49:15 info: Running /etc/ha.d/rc.d/status status
heartbeat: 2004/11/02_14:49:15 info: No local resources [/usr/lib/heartbeat/ResourceManager listkeys test7] to acquire.
heartbeat: 2004/11/02_14:49:15 info: Taking over resource group IPaddr::210.75.11.37/32/210.75.11.39
heartbeat: 2004/11/02_14:49:15 info: Acquiring resource group: test9 IPaddr::210.75.11.37/32/210.75.11.39 ipvsadm ldirectord
heartbeat: 2004/11/02_14:49:15 info: Running /etc/ha.d/resource.d/IPaddr 210.75.11.37/32/210.75.11.39 start
heartbeat: 2004/11/02_14:49:15 info: /sbin/ifconfig eth0:0 210.75.11.37  netmask 255.255.255.255        broadcast 210.75.11.39
heartbeat: 2004/11/02_14:49:15 info: Sending Gratuitous Arp for 210.75.11.37 on eth0:0 [eth0]
heartbeat: 2004/11/02_14:49:15 /usr/lib/heartbeat/send_arp -i 500 -r 10 -p /var/lib/heartbeat/rsctmp/send_arp/send_arp-210.75.11.37 eth0 210.75.11.37 auto 210.75.11.37 ffffffffffff
heartbeat: 2004/11/02_14:49:15 info: Running /etc/init.d/ipvsadm  start
heartbeat: 2004/11/02_14:49:17 info: Running /etc/ha.d/resource.d/ldirectord  start
heartbeat: 2004/11/02_14:49:17 info: /usr/lib/heartbeat/mach_down: nice_failback: foreign resources acquired
heartbeat: 2004/11/02_14:49:17 info: mach_down takeover complete.
heartbeat: 2004/11/02_14:49:17 info: Initial resource acquisition complete (mach_down)
heartbeat: 2004/11/02_14:49:17 info: mach_down takeover complete for node test9.
heartbeat: 2004/11/02_14:49:26 info: Local Resource acquisition completed. (none)
heartbeat: 2004/11/02_14:49:26 info: local resource transition completed.


[root@test7 root]# tail -f /var/log/ldirectord.log
[Tue Nov  2 13:55:29 2004|ldirectord] Restored real server: 210.75.11.36:80 (1 x 210.75.11.37:80) (Weight set to 1)
[Tue Nov  2 14:05:52 2004|ldirectord] Restored real server: 210.75.11.34:80 (2 x 210.75.11.37:80) (Weight set to 1)
[Tue Nov  2 14:11:12 2004|ldirectord] Quiescent real server: 210.75.11.34:80 (3 x 210.75.11.37:80) (Weight set to 0)
[Tue Nov  2 14:14:40 2004|ldirectord] Restored real server: 210.75.11.34:80 (2 x 210.75.11.37:80) (Weight set to 1)
[Tue Nov  2 14:15:51 2004|ldirectord] Quiescent real server: 210.75.11.36:80 (3 x 210.75.11.37:80) (Weight set to 0)
[Tue Nov  2 14:22:06 2004|ldirectord] Restored real server: 210.75.11.36:80 (2 x 210.75.11.37:80) (Weight set to 1)
[Tue Nov  2 14:43:35 2004|ldirectord] Removed real server: 210.75.11.34:80 (2 x 210.75.11.37:80
[Tue Nov  2 14:43:35 2004|ldirectord] Removed real server: 210.75.11.36:80 (1 x 210.75.11.37:80
[Tue Nov  2 14:43:35 2004|ldirectord] Removed virtual server: 210.75.11.37:80
[Tue Nov  2 14:43:35 2004|ldirectord] Linux Director Daemon terminated on signal: TERM
[Tue Nov  2 14:49:17 2004|ldirectord] ldirectord is stopped for /etc/ha.d/ldirectord.cf
[Tue Nov  2 14:49:17 2004|ldirectord] Exiting with exit_status 1: Initialisation Error
[Tue Nov  2 14:49:17 2004|ldirectord] Starting Linux Director v1.85 as daemon
[Tue Nov  2 14:49:17 2004|ldirectord] Changed virtual server: 210.75.11.37:80
[Tue Nov  2 14:49:17 2004|ldirectord] Changed real server: 210.75.11.34:80 (1 x 210.75.11.37:80)
[Tue Nov  2 14:49:17 2004|ldirectord] Changed real server: 210.75.11.36:80 (2 x 210.75.11.37:80)
[Tue Nov  2 14:49:17 2004|ldirectord] Restored real server: 210.75.11.34:80 (2 x 210.75.11.37:80) (Weight set to 1)
[Tue Nov  2 14:49:17 2004|ldirectord] Restored real server: 210.75.11.36:80 (3 x 210.75.11.37:80) (Weight set to 1)
[Tue Nov  2 15:01:14 2004|ldirectord] Quiescent real server: 210.75.11.36:80 (4 x 210.75.11.37:80) (Weight set to 0)
[Tue Nov  2 15:02:04 2004|ldirectord] Restored real server: 210.75.11.36:80 (3 x 210.75.11.37:80) (Weight set to 1)
[Tue Nov  2 15:03:21 2004|ldirectord] Quiescent real server: 210.75.11.34:80 (4 x 210.75.11.37:80) (Weight set to 0)
[Tue Nov  2 15:05:33 2004|ldirectord] Restored real server: 210.75.11.34:80 (3 x 210.75.11.37:80) (Weight set to 1)

重启后我尝试了down掉34、36的httpd服务,再观察ipvsadm
[root@test7 root]# ipvsadm
IP Virtual Server version 1.0.8 (size=65536)
Prot LocalAddressort Scheduler Flags
  -> RemoteAddressort           Forward Weight ActiveConn InActConn
TCP  210.75.11.37:http wlc
  -> 210.75.11.34:http            Route   1      0          3         
  -> test9:http                   Route   1      0          0   

虽然ipvsadm一直没有变化,但我在外部访问和/var/log/ldirectord.log的信息来看,ldirectord已经生效了





非常激动,我再增加一个http服务试试
回复

使用道具 举报

 楼主| 发表于 2004-11-2 15:38:35 | 显示全部楼层
虽然http服务已经ok,但是还是有一个错误

[Tue Nov  2 14:49:17 2004|ldirectord] ldirectord is stopped for /etc/ha.d/ldirectord.cf
[Tue Nov  2 14:49:17 2004|ldirectord] Exiting with exit_status 1: Initialisation Error  #这个错误虽然没有影响ldirectord,但不

知道产生的原因是什么
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2025-2-25 01:39 , Processed in 0.032604 second(s), 12 queries .

© 2001-2025 Discuz! Team. Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表