[摘要] 发现nfs线程数不够了,提示要增加一些数量的threads,syslog中有很多如下日志:
[2566628.826692] nfsd: too many open connections, consider increasing the number of threads.
现有的nfsd状态:
# cat /proc/net/rpc/nfsd rc 0 268 742119 fh 0 0 0 0 0 io 2476981939 0 th 8 0 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ra 32 30104 0 0 0 0 0 0 0 0 0 71174 net 742701 314 742393 10103960 rpc 742406 310 310 0 0 proc2 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 proc3 22 105 71158 0 175642 184711 17103 101277 0 0 0 0 0 0 0 0 0 0 8916 102 202 0 0 proc4 2 101 182991 proc4ops 59 0 0 0 18112 8341 0 0 0 3239 71595 11834 0 0 0 0 107097 0 0 8344 0 5100 0 181968 0 235 5735 4406 0 0 0 652 8342 8344 0 0 134 134 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
原来nfs默认启动了8个thread,应该是不够了,可以手动修改增加一些。
Debian下修改nfs的默认线程数:
# cat /etc/default/nfs-kernel-server
# Number of servers to start up
# RPCNFSDCOUNT=8
RPCNFSDCOUNT=32
重启nfs
/etc/init.d/nfs-kernel-server restart
如果操作系统是CentOS6.x以上,修改nfs的默认线程数方式如下:
vim /etc/sysconfig/nfs
# Number of nfs server processes to be started.
# The default is 8.
#RPCNFSDCOUNT=8
#RPCNFSDCOUNT=32
再看看目前nfs的状况:
# cat /proc/net/rpc/nfsd rc 0 268 742121 fh 0 0 0 0 0 io 2476981939 0 th 32 0 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ra 64 30104 0 0 0 0 0 0 0 0 0 71174 net 742703 316 742393 10132592 rpc 742408 310 310 0 0 proc2 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 proc3 22 107 71158 0 175642 184711 17103 101277 0 0 0 0 0 0 0 0 0 0 8916 102 202 0 0 proc4 2 101 182991 proc4ops 59 0 0 0 18112 8341 0 0 0 3239 71595 11834 0 0 0 0 107097 0 0 8344 0 5100 0 181968 0 235 5735 4406 0 0 0 652 8342 8344 0 0 134 134 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # cat /proc/fs/nfsd/threads 32 # cat /proc/fs/nfsd/pool_threads 32 # cat /proc/fs/nfsd/pool_stats # pool packets-arrived sockets-enqueued threads-woken threads-timedout 0 161938 2 92673 0
重启后在syslog日志中在没有发现任何 nfsd: too many open connections 的日志了。
Dec 20 01:54:01 sudops.com kernel: [2566629.577851] nfsd: last server has exited, flushing export cache Dec 20 01:54:02 sudops.com kernel: [2566630.613091] svc: failed to register lockdv1 RPC service (errno 97). Dec 20 01:54:02 sudops.com kernel: [2566630.613217] NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory Dec 20 01:54:02 sudops.com kernel: [2566630.613239] NFSD: starting 90-second grace period