4/7/16

Too many files open - RHEL 5-7



RHEL 5,6,7

    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, as root edit the /etc/sysctl.conf and add the following to the end of the file:
          fs.file-max = 495000
      Note: 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, as root issue the following commands:
          # su - <user>
      $ ulimit -n
    • The default setting for this is usually 1024. If more is needed for a specific user then as root modify it in the /etc/security/limits.conf file:
          user - nofile 2048
      This will set the maximum open files for the specific "user" to 2048 files.
    ** WARNING **
    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 as root edit /etc/security/limits.conf file 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:

    Quick HTTP to HTTPS - Apache2

    There are several methods for redirecting your Apache-based website visitors who might type your servers URL using the plain (non-secure) HT...