In Linux, the default number of openfiles is 1024. sometimes the application reports the Toomanyopenfiles error because the number of openfiles is insufficient. My Linux is CentOS5.6 modification method: www.2cto.com (1) ulimit-HSn102400 this is just...
In Linux, the default number of open files is 1024. sometimes the application reports the Too program open files error because the number of open files is insufficient.
I use CentOS 5.6 for Linux.
Modification method: www.2cto.com
(1) ulimit-HSn 102400
This is only valid on the current terminal. after exiting, open files becomes the default value.
(2) write ulimit-HSn 102400 to/etc/profile, because/etc/profile is automatically executed every time you log on to the terminal.
(3) for the value of the modified open files to take effect permanently, you must modify the configuration file:/etc/security/limits. conf. after this file, add:
* Soft nofile 102400
* Hard nofile 102400
This method takes effect only after the machine is restarted.
(4) to increase the number of open files of a program, you can add the command in (1) before the startup script. When the program is a daemon, this method may be invalid and there is no terminal.
PS:
Another kernel parameter that affects the value of open files is file-max, which is the total limit of the Linuxt system. You can view it in the following text:
Cat/proc/sys/fs/file-max
Or
Sysctl-a | grep fs. file-max
You can use the following method to modify file-max on the server:
(1) restore to the default value after the machine is restarted
Echo 34166>/proc/sys/fs/file-max
Or
Sysctl-w "fs. file-max = 34166"
(2) modify the configuration file/etc/sysctl. conf and add a line at the end:
Fs. file-max = 34166
Then restart the machine to make it take effect. It will take effect permanently.
From Pig Run