In CentOS ulimit to explain to you before, let us know the next CentOS ulimit, then a comprehensive introduction CentOS ulimit, hope to be useful. CentOS ulimit value (Linux file handle number) in CentOS5 (RHEL5) of the adjustment.
Following the deployment of applications in Linux, when sometimes encounter Socket / File: Can't open so many files in question, such as Squid do have agency, when the file open count of more than 900 per hour will drop very fast, there is could not open page.
In fact, Linux is a file handle limit, and Linux the default is not very high, typically 1024, the production server is actually very easy to achieve with this number.
View Methods
We can use CentOS ulimit-a to view all limit
[Root @ centos5 ~] # Centos ulimit-a
core file size (blocks,-c) 0
data seg size (kbytes,-d) unlimited
max nice (-e) 0
file size (blocks,-f) unlimited
pending signals (-i) 4096
max locked memory (kbytes,-l) 32
max memory size (kbytes,-m) unlimited
open files (-n) 1024
pipe size (512 bytes,-p) 8
POSIX message queues (bytes,-q) 819200
max rt priority (-r) 0
stack size (kbytes,-s) 10240
cpu time (seconds,-t) unlimited
max user processes (-u) 4096
virtual memory (kbytes,-v) unlimited
file locks (-x) unlimited | | < Which "open files (-n) 1024" is the Linux operating system, a process the number of open file handles limit (also includes the number of open SOCKET, MySQL can affect the number of concurrent connections). This value can be used CentOS ulimit command to modify the However, CentOS ulimit command changes the value only for the current logged-on user's current environment and effective, system restart or user exits will be invalid. Overall system limit is here, / proc / sys / fs / file-max. Can see the current value of cat, modify / etc / sysctl.conf can also be controlled. There is also a, / proc / sys / fs / file-nr, can see the whole system, the number of file handles currently in use Find file handle problem, there is a very useful program lsof. Can be easily opened to see who handles a process. You can also see a file / directory is what the process of taking up. Modification method To make permanent changes CentOS ulimits numerical effect, you must modify the configuration files, you can modify to CentOS ulimit command into / etc / profile which, this method is not convenient, there is a way to modify / etc / sysctl.conf . I modified, tested, but the CentOS ulimits-a user will not change. But / proc / sys / fs / file-max value has changed. (I give the command into the rc.local of failure) I think the right thing to do is modify the / etc / security / limits.conf There are very detailed notes, such as * Soft nofile 32768 * Hard nofile 65536 Can also be run directly below the shell. Copy directly to your terminal to run just fine. echo-ne " * Soft nofile 65536 * Hard nofile 65536 ">> / Etc / security / limits.conf
Restrictions on the file handle can be unified into soft-32768 hard 65536. Configuration file is the front of the domain, set to star on behalf of the overall situation, plus you can make a different for different users limit attention. That among the hard limit is the actual restrictions, and soft constraints, is warnning restrictions will only make the warning. In fact, CentOS ulimit command itself is divided soft and hard settings, add-H is hard, add-S is the soft limit by default shows the soft If running CentOS ulimit command does not modify the time with it, are two parameters change with it. effect
Re-login to see modifying. (My system is CentOS5.1. Revised and re-login after immediately. Can use CentOS ulimit-a view confirmed.)
If you are using squid, you should be in / etc / init.d / squid file join CentOS ulimit-HSn 65535. In addition, in squid.conf should join max_filedesc 16384
没有评论:
发表评论