- 论坛徽章:
- 0
|
20060111
www.justgo.com.cn
无法登陆
解决方法之一:
1 # echo 2048 > /proc/sys/fs/file-max
将句柄最大值赋为:2048
2 编辑 /etc/security/limits.conf
在 # 后加入一行:* -nofile 2048
3 # ulimit -n
如果显示的值为:2048 说明修改成功
重启系统 生效
具体文档如下:
Resolution:
The current setting for maximum number of open files can be viewed with the command:
ulimit -n
This number indicates the maximum number of files normal users (i.e. non-root) can have open in a single session. Note that for the root user, ulimit -n will sometimes output 1024 even after following the procedure to increase the maximum number of open files. This won't effect root's ability to open large numbers of files, as only normal users are bound by this value.
To increase the maximum number of open files beyond the default of 1024, two changes to the system may be necessary. In these examples, we will increase the maximum number of open files to the arbitrary value of 2048. All changes need to be made by the root user and users will need to log out and log back in before the changes will take effect.
1. Configure the system to accept the desired value for maximum number of open files
Check the value in /proc/sys/fs/file-max to see if it is larger than the value needed for the maximum number of open files:
# cat /proc/sys/fs/file-max
If the value isn't large enough, echo an appropriate number into the variable and add the change to /etc/sysctl.conf to make it persistent across reboots. If the number is already larger than the value you wish to use, skip to step 2.
# echo 2048 > /proc/sys/fs/file-max
and edit /etc/sysctl.conf to include the line:
fs.file-max = 2048
2. Set the value for maximum number of open files
In the file /etc/security/limits.conf, below the commented line that reads
#
add this line:
* - nofile 2048
This line sets the default number of open file descriptors for every user on the system to 2048. Note that the "nofile" item has two possible limit values under the header: hard and soft. Both types of limits must be set before the change in the maximum number of open files will take effect. By using the "-" character, both hard and soft limits are set simultaneously.
The hard limit represents the maximum value a soft limit may have and the soft limit represents the limit being actively enforced on the system at that time. Hard limits can be lowered by normal users, but not raised and soft limits cannot be set higher than hard limits. Only root may raise hard limits.
When increasing file limit descriptors, you may want to simply double the value. For example, if you need to increase the default value of 1024, increase the value to 2048 first. If you need to increase it again, try 4096, etc.
The information provided in this document is for your information only. The origin of this information may be internal or external to Red Hat. While Red Hat attempts to verify the validity of this information before it is posted, Red Hat makes no express or implied claims to its validity.
? 2003-2005 Red Hat, Inc. All rights reserved. This article is made available for copying and use under the Open Publication License, v1.0 which may be found at
http://www.opencontent.org/openpub/
.
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/12737/showart_67290.html |
|