You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

In Linux, there are some cases that application needs to open multiple files at the same time - probably database like MySQL is one of the cases accessing multiple files at the same time, because MySQL create files for table and its index on the file system, so it will cause opening multiple files at the same time.

By the way, there are some way can check and increase the maximum allowed files you can open at the same time on Centos.

Step-by-step guide

  1. Find Linux Open File Limit

    # cat /proc/sys/fs/file-max
    
    176772

    The number you will see shous the number of files that a user can have opened per login session. The result might be different depending on your system.

  2. Check Hard Limit in Linux

    # ulimit -Hn
    
    4096
  3. Check Soft Limits in Linux

    # ulimit -Sn
    
    1024
  4. Set User Level Open File limits in Linux
    You may want to apply limits per user basis like apache, mysqld, and etc. For that purpose, as user root, you will need to edit the following file:

    # vi /etc/security/limits.conf

    To increase soft and hard limits, please add following lines at the end of the file.

    * hard nofile 500000
    * soft nofile 500000
    root hard nofile 500000
    root soft nofile 500000

    Once you login the machine again, your soft/hard limits will be changed like you set above.

 



  • No labels