Versiunile în comparație

Cheie

  • Această linie a fost adăugată.
  • Acest rând a fost eliminat.
  • Formatarea a fost modificată.

...

  1. Find Linux Open File Limit

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

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

    To increase edit vi /etc/sysctl.conf add the below line, save and exit

    Code Block
    fs.file-max = 353544


  2. Check Hard Limit in Linux

    Code Block
    # ulimit -Hn
    
    4096


  3. Check Soft Limits in Linux

    Code Block
    # 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:

    Code Block
    # sudo vi /etc/security/limits.conf

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

    Code Block
    * soft nproc 500000
    * hard nproc 500000
    * soft nofile 500000
    * hard nofile 500000

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


  5. Next, run the command:

    Code Block
    # sudo sysctl -p


  6. for MySQL, vi /usr/lib/systemd/system/mysqld.service and add the below 2 lines at the end, save and exit

    Code Block
    LimitNOFILE=65535
    LimitNPROC=65535
    LimitMEMLOCK=65535

    or you can put as following even though that looks so dangerous

    Code Block
    LimitNOFILE=infinity
    LimitNPROC=infinity
    LimitMEMLOCK=infinity


  7. then increase the table_open_cache and open_files_limit in my.cnf

    Code Block
    open_files_limit=10240
    table_open_cache=10240

    and you should run below command

    Code Block
    # sudo systemctl daemon-reload




  8. if you modified MySQL config, restart 

Content by Label
showLabelsfalse
max5
spacesKB
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel = "kb-how-to-article" and type = "page" and space = "KB"
labelskb-how-to-article

...

hiddentrue
  1. MySQL and check values for table_open_cache and open_files_limit

    Code Block
    # systemctl restart mysqld.service

...