How do I increase the maximum number of open files under CentOS Linux? How do I open more file descriptors under Linux?

The ulimit command provides control over the resources available to the shell and/or to processes started by it, on systems that allow such control. The maximum number of open file descriptors displayed with following command (login as the root user).

Command To List Number Of Open File Descriptors

Use the following command command to display maximum number of open file descriptors:
cat /proc/sys/fs/file-max
Output:

75000

75000 files normal user can have open in single login session. To see the hard and soft values, issue the command as follows:
# ulimit -Hn
# ulimit -Sn

To see the hard and soft values for httpd or oracle user, issue the command as follows:
# su - username
In this example, su to oracle user, enter:
# su - oracle
$ ulimit -Hn
$ ulimit -Sn

System-wide File Descriptors (FD) Limits

The number of concurrently open file descriptors throughout the system can be changed via /etc/sysctl.conf file under Linux operating systems.

The Number Of Maximum Files Was Reached, How Do I Fix This Problem?

Many application such as Oracle database or Apache web server needs this range quite higher. So you can increase the maximum number of open files by setting a new value in kernel variable /proc/sys/fs/file-max as follows (login as the root):
# sysctl -w fs.file-max=100000
Above command forces the limit to 100000 files. You need to edit /etc/sysctl.conf file and put following line so that after reboot the setting will remain as it is:
# vi /etc/sysctl.conf
Append a config directive as follows:
fs.file-max = 100000
Save and close the file. Users need to log out and log back in again to changes take effect or just type the following command:
# sysctl -p
Verify your settings with command:
# cat /proc/sys/fs/file-max
OR
# sysctl fs.file-max

User Level FD Limits

The above procedure sets system-wide file descriptors (FD) limits. However, you can limit httpd (or any other users) user to specific limits by editing /etc/security/limits.conf file, enter:
# vi /etc/security/limits.conf
Set httpd user soft and hard limits as follows:
httpd soft nofile 4096
httpd hard nofile 10240

Save and close the file. To see limits, enter:
# su - httpd
$ ulimit -Hn
$ ulimit -Sn

A note about RHEL/CentOS/Fedora/Scientific Linux users

Edit /etc/pam.d/login file and add/modify the following line (make sure you get pam_limts.so):

session required pam_limits.so

Save and close the file.

FROM:https://www.cyberciti.biz/faq/linux-increase-the-maximum-number-of-open-files/

Linux Increase The Maximum Number Of Open Files / File Descriptors (FD)的更多相关文章

  1. Maximum number of WAL files in the pg_xlog directory (2)

    Jeff Janes: Hi, As part of our monitoring work for our customers, we stumbled upon an issue with our ...

  2. Maximum number of WAL files in the pg_xlog directory (1)

      Guillaume Lelarge: Hi, As part of our monitoring work for our customers, we stumbled upon an issue ...

  3. the max number of open files 最大打开文件数 ulimit -n RabbitMQ调优

    Installing on RPM-based Linux (RHEL, CentOS, Fedora, openSUSE) — RabbitMQ https://www.rabbitmq.com/i ...

  4. The maximum number of processes for the user account running is currently , which can cause performance issues. We recommend increasing this to at least 4096.

    [root@localhost ~]# vi /etc/security/limits.conf # /etc/security/limits.conf # #Each line describes ...

  5. tomcat 大并发报错 Maximum number of threads (200) created for connector with address null and port 8080

    1.INFO: Maximum number of threads (200) created for connector with address null and port 8091 说明:最大线 ...

  6. tomcat 大并发报错 Maximum number of threads (200) created for connector with address null and port 80

    1.INFO: Maximum number of threads (200) created for connector with address null and port 80 说明:最大线程数 ...

  7. "Your computer could not be joined to the domain. You have exceeded the maximum number of computer accounts you are allowed to create in this domain. Contact your system administrator to have this limit reset or increased."

    用一个普通的域帐号玩私有云的时候,遇到了如下的报错. "Your computer could not be joined to the domain. You have exceeded ...

  8. InnoDB: The log sequence number in ibdata files does not match

    InnoDB: The log sequence number in ibdata files does not matchInnoDB的:在ibdata文件的日志序列号不匹配 可能ibdata文件损 ...

  9. tomcat调优方案Maximum number of threads (200) created for connector with address null and port 8091

    1.tomcat6大并发出现:INFO: Maximum number of threads (200) created for connector with address null and por ...

随机推荐

  1. 常用原生JS兼容性写法汇总

    1.添加事件方法 addHandler:function(element,type,handler){ if(element.addEventListener){//检测是否为DOM2级方法 elem ...

  2. Codeforces Round #204 (Div. 2): A

    超级大水题: 只要用到一个小学用过的结论就可:能被9整除的数它的各位数相加能被9整除: 代码: #include<iostream> #define maxn 1005 using nam ...

  3. 测试WWW方案(反向代理,负载均衡,HTTP加速缓存)

    大约图如下: NGINX FRONT(80)--->VARNISH(8080)---->LNMP BACKEND 1(80) |--->LNMP BACKEND 2(80) 主要是前 ...

  4. 【BZOJ1036】 树的统计Count (树链剖分)

    Description 一棵树上有n个节点,编号分别为1到n,每个节点都有一个权值w.我们将以下面的形式来要求你对这棵树完成一些操作: I. CHANGE u t : 把结点u的权值改为t II. Q ...

  5. 一个漂亮的DIV搜索条

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  6. Guava学习

    Guava学习笔记目录 Guava 是一个 Google 的基于java1.6的类库集合的扩展项目,包括 collections, caching, primitives support, concu ...

  7. 【HDOJ】1429 胜利大逃亡(续)

    BFS+状态压缩,做了很多状态压缩了.今晚把八数码问题给搞定了. #include <iostream> #include <queue> #include <cstri ...

  8. 悟透Javascript之 原型prototype

    构造函数的Prototype上定义的方法确实可以通过对象直接调用,而且代码是共享的.我表示我不懂.太难理解了,艹.在Javascript中,prototype不但能让对象共享自己的财富,而且proto ...

  9. bzoj1832

    其实这道题是和bzoj1787一样的但我用bzoj1787MLE了,于是正好练一下树上倍增 type node=record po,next:longint; end; ..] of node; an ...

  10. 转 @RenderBody()和@RenderSection()

    强大的Razor引擎 一.Razor基础简介 Razor采用了cshtml后缀的文件名,截图如下: A. 版面布局 从图上看到,新的视图引擎已经没有了Site.Master这种MasterPage了, ...