|
In this article only on RHEL6.4 test.
Linux handle limit is divided into a system-wide limit and 2 user-level restrictions:
/ Proc / sys / fs / nr_open> / proc / sys / fs / file-max> = ulimit -Hn> = ulimit -Sn
1 system-wide limit
1.1 / proc / sys / fs / nr_open
The total number of system file system supports file handle limit, the default value 1048576 (1M). The upper limit value is limited by system memory. This is the maximum of all restrictions.
1.2 / proc / sys / fs / file-max
The total number of file system supports file systems handle maximum must be less than nr_open view commands (the following three command equivalent):
[Root @ vm-cdh4 ~] # sysctl -a | grep -i file-max --color
fs.file-max = 188436
[Root @ vm-cdh4 ~] # cat / proc / sys / fs / file-max
188436
[Root @ vm-cdh4 ~] # sysctl -e fs.file-max
fs.file-max = 188436
View the current number of open file descriptors used by the system command:
[Root @ vm-cdh4 ~] # cat / proc / sys / fs / file-nr
8320188436
Wherein the file-max = 188436
1.3 Change file-max
Temporary change, disappear after reboot:
[Root @ vm-cdh4 ~] # sysctl -w fs.file-max = 102400
Permanent changes in /etc/sysctl.conf added (for 2.2 and 2.4 kernel):
fs.file-max = 102400
#### Only for 2.2 kernel:
#### Fs.inode-max = 102400
When the change /etc/sysctl.conf, run the following command to make the changes effective immediately:
[Root @ vm-cdh4 ~] # sysctl -p
2 user-level restrictions
2.1 hard limit ulimit -Hn
.. A single process handles hard maximum number of <= file-max View command:
[Root @ vm-cdh4 ~] # ulimit -Hn
4096
Temporary changes disappear after reboot:
[Root @ vm-cdh4 ~] # ulimit -Hn 8192
[Root @ vm-cdh4 ~] # ulimit -Hn
8192
2.2 soft cap ulimit -Sn
Soft cap the number of handles a single process, <= ulimit -Hn view commands:
[Root @ vm-cdh4 ~] # ulimit -Sn
1024
[Root @ vm-cdh4 ~] # ulimit -n
1024
Temporary changes disappear after reboot:
[Root @ vm-cdh4 ~] # ulimit -Sn 8000
[Root @ vm-cdh4 ~] # ulimit -n
8000
2.3 modify the maximum number of handles a single process
While temporarily modify the soft and hard limit (<= file-max) disappears after reboot:
[Root @ vm-cdh4 ~] # ulimit-SHn 10240
Permanently modify the soft and hard limit (RHEL6.4), provided /etc/security/limits.conf in (* represents all users):
# ......
# @ Student - maxlogins 4
* Hard nofile 10240
* Soft nofile 10240
# End of file |
|
|
|