ITPub博客

首页 > Linux操作系统 > Linux操作系统 > squid!Your cache is running out of file

squid!Your cache is running out of file

原创 Linux操作系统 作者:lfree 时间:2014-02-21 09:49:57 0 删除 编辑

[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.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/267265/viewspace-1085012/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    2668
  • 访问量
    6426121