lvs keepalived nfs

192.168.1.109 lvs vip
192.168.1.136 rs1 rip nfs-server
192.168.1.137 rs2 rip nfs-server

rs1,rs2#showmount -e
/mnt/ *

lvs#ipvsadm -l
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 192.168.1.109:sunrpc lc persistent 86400
-> 192.168.1.137:sunrpc Route 1 0 2
-> 192.168.1.136:sunrpc Route 1 0 1
UDP 192.168.1.109:sunrpc lc persistent 86400
-> 192.168.1.137:sunrpc Route 1 0 1
-> 192.168.1.136:sunrpc Route 1 0 2
TCP 192.168.1.109:nfs lc persistent 86400
-> 192.168.1.137:nfs Route 1 1 4
-> 192.168.1.136:nfs Route 1 1 2
UDP 192.168.1.109:nfs lc persistent 86400
-> 192.168.1.137:nfs Route 1 0 0
-> 192.168.1.136:nfs Route 1 0 0
UDP 192.168.1.109:mountd lc persistent 86400
-> 192.168.1.137:mountd Route 1 0 2
-> 192.168.1.136:mountd Route 1 0 4
TCP 192.168.1.109:mountd lc persistent 86400
-> 192.168.1.137:mountd Route 1 0 0
-> 192.168.1.136:mountd Route 1 0 0

当某个client端第一次挂载nfs: mount 192.168.1.109:/mnt/ /mnt 的时候出现
mount.nfs: Stale NFS file handle 的错误提示,查nfs-utils-1.2.3/README 得
“any NFS requests that arrive before mountd is started will get replied to with a 'Stale NFS File handle' error.” 此种情况也会出现在当persistent timeout的时候,或者在rs1的nfs server出现问题时候 。在这些时候同一client的连接没有被分配到同一个rs上,如下:

lvs#ipvsadm -lcn (在这里只列出client 192.168.1.177的连接情况)
IPVS connection entries
pro expire state source virtual destination
UDP 03:43 UDP 192.168.1.177:57537 192.168.1.109:1011 192.168.1.136:1011
TCP 1408:40 NONE 192.168.1.177:0 192.168.1.109:1011 192.168.1.136:1011
TCP 1438:43 NONE 192.168.1.177:0 192.168.1.109:111 192.168.1.136:111
TCP 1438:43 NONE 192.168.1.177:0 192.168.1.109:2049 192.168.1.137:2049
TCP 00:43 FIN_WAIT 192.168.1.177:849 192.168.1.109:2049 192.168.1.137:2049
UDP 03:43 UDP 192.168.1.177:57547 192.168.1.109:111 192.168.1.136:111
TCP 00:43 FIN_WAIT 192.168.1.177:49412 192.168.1.109:111 192.168.1.136:111
TCP 00:43 FIN_WAIT 192.168.1.177:37922 192.168.1.109:2049 192.168.1.137:2049
UDP 1438:43 UDP 192.168.1.177:0 192.168.1.109:1011 192.168.1.136:1011
UDP 1438:43 UDP 192.168.1.177:0 192.168.1.109:111 192.168.1.136:111
UDP 03:43 UDP 192.168.1.177:1005 192.168.1.109:1011 192.168.1.136:1011

这种情况应该怎么解决?!!望赐教

Forums:

章博士你好,这个问题我终于搞明白了,现在如果要彻底解决问题,我觉得应该要像ftp那样,在 net/netfilter/ipvs/下面增加一个ip_vs_nfs.c,或者这样一类问题的综合解决办法。我现在在看源码,试图修改一下,不过我的水平还低,不知章博士能否帮忙?等待好消息。。。

我们在调度算法里面,是按照VIP:PORT为单位来调度的(个人理解,不知是否对),要是我们能在增加一个组策略,组里面包括vip:port,然后我们按照组来调度的话,我这个问题就能解决了,有高手帮忙不?

Whoa, things just got a whole lot earsie.