[20140221]squid WARNING! Your cache is running out of filedescriptors.txt
--这一阵子,我们的代理出现一些问题.
--我检查发现如下:
2014/02/21 14:53:10| client_side.cc(2993) okToAccept: WARNING! Your cache is running out of filedescriptors
--看来文件描述设置太小,前面的管理人员设置有问题.我google,找到一些链接:
http://www.cyberciti.biz/faq/squid-proxy-server-running-out-filedescriptors/
# squidclient -p 31888 mgr:info | grep 'file descri'
Maximum number of file descriptors: 1024
Available number of file descriptors: 12
Reserved number of file descriptors: 100
--注意这样写不行.squidclient mgr:info -p 31888 ,Available number of file descriptors已经很小.
--增加file descriptors的方法,修改/etc/security/limits.conf:
Squid increase the maximum file descriptors
First, update /etc/security/limits.conf file:
# vi /etc/security/limits.conf
Append following line to increase current limit from 1024 to 4096:
* - nofile 4096
Save and close the file. You must re-login to check new limits:
# ulimit -a | grep 'open files'
Sample output:
open files (-n) 4096
Next you need to set the maximum number of open file descriptors by modifying squid proxy server configuration as per
your Linux distribution.
Set max_filedesc under RHEL / Red Hat / CentOS / Fedora Linux
Stop the Squid as changes of this value isn't respected by reconfigure command. This value should be changed only if
there isn't any active squid process.
# service squid stop
Open /etc/squid/squid.conf file
# vi /etc/squid/squid.conf
Append / add / modify max_filedesc directive:
max_filedesc 4096
Save and close the file. Start the squid proxy server:
# service squid start
Now again run squidclient command or check log files for messages:
# squidclient mgr:info
Set max_filedesc under Ubuntu / Debian Linux
First, stop squid proxy server, enter:
# /etc/init.d/squid stop
OR
$ sudo /etc/init.d/squid stop
Open /etc/default/squid to set max. number of filedescriptors to use. You can increase this on a busy
cache to a maximum of (currently) 4096 filedescriptors. Default is 1024.
$ sudo vi /etc/default/squid
OR
# vi /etc/default/squid
Now set SQUID_MAXFD:
SQUID_MAXFD=4096
Save and close the file. Start the squid proxy server:
$ sudo /etc/init.d/squid start
Verify that it is working with new limits:
# squidclient mgr:info | grep 'file descri'
--我选择第1种方式修改.增加到65536.要重启squid就可以了.
# squidclient -p 31888 mgr:info | grep -A7 'File descriptor usage for squid'
File descriptor usage for squid:
Maximum number of file descriptors: 65536
Largest file desc currently in use: 2388
Number of file desc currently in use: 2248
Files queued for open: 0
Available number of file descriptors: 63288
Reserved number of file descriptors: 100
Store Disk files open: 4
--可以发现现Number of file desc currently in use增加到2248.