Issue
- How to correct the error "Too many files open"
- Error during login "Too many open files" and the session gets terminated automatically.
Resolution
- This error is generated when the open file limit for a user or system exceeds the default setting.
SYSTEM Wide settings
- To see the settings for maximum open files for the OS level, use following command:# cat /proc/sys/fs/file-max
- This value means that the maximum number of files all processes running on the system can open. By default this number will automatically vary according to the amount of RAM in the system. As a rough guideline it will be approximately 100000 files per GB of RAM, so something like 400000 files on a 4GB machine and 1600000 on a 16GB machine. To change the system wide maximum open files, asrootedit the/etc/sysctl.confand add the following to the end of the file:fs.file-max = 495000Note: The above example will set the maximum number of files to 495,000 and will take effect when the system is rebooted.
- Then issue the following command to activate this change to the live system:# sysctl -p
Per USER Settings
- To see the setting for maximum open files for a user, asrootissue the following commands:# su - <user>$ ulimit -n
- The default setting for this is usually1024. If more is needed for a specific user then asrootmodify it in the/etc/security/limits.conffile:user - nofile 2048This will set the maximum open files for the specific"user"to2048files.
** WARNING **
The limits module that handles the setting of these values first reads
The limits module that handles the setting of these values first reads
/etc/security/limits.conf and then reads each file matching/etc/security/limits.d/*.conf This means that any changes you make in /etc/security/limits.conf may be overridden by a subsequent file. These files should be reviewed as a set to ensure they meet your requirements.- To do a system wide increase for all users then asrootedit/etc/security/limits.conffile and add the following:* - nofile 2048
- This sets the maximum open files for ALL users to 2048 files. These setting will require a reboot to become active.
 
 
No comments:
Post a Comment