一、查看当前用户对进程打开文件最大数的限制

$ ulimit -a | grep open

二、系统对进程打开文件最大数是如何限制的

先来看man的一段解析:

    /proc/sys/fs/file-max
This file defines a system-wide limit on the number of open files for all processes. (See also setrlimit(), which can be
used by a process to set the per-process limit, RLIMIT_NOFILE, on the number of files it may open.) If you get lots of error
messages in the kernel log about running out of file handles (look for "VFS: file-max limit <number> reached"), try increas‐
ing this value: echo > /proc/sys/fs/file-max The kernel constant NR_OPEN imposes an upper limit on the value that may be placed in file-max. If you increase /proc/sys/fs/file-max, be sure to increase /proc/sys/fs/inode-max to - times the new value of
/proc/sys/fs/file-max, or you will run out of inodes. Privileged processes (CAP_SYS_ADMIN) can override the file-max limit.

(1)修改系统总限制(永久生效)

echo "" > /proc/sys/fs/file-max  

(2)修改进程的软硬限制(永久生效)

vi /etc/security/limits.conf  

添加:

* soft nofile
* hard nofile

注:*表示所有用户都生效

三、重启shell,校验配置是否生效

$ ulimit -a | grep open

原文出自:http://blog.csdn.net/daiyudong2020/article/details/77828959

linux设置最大打开文件数的更多相关文章

  1. umilit 修改 linux 最多可打开文件数

    ulimit -n 修改 临时修改:   ulimit -SHn 65535 永久修改:    echo '*  -  nofile  65535' >> /etc/security/li ...

  2. Linux 打开文件数

    linux设置最大打开文件数 - daiyudong2020的博客 - CSDN博客 https://blog.csdn.net/daiyudong2020/article/details/77828 ...

  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. linux 打开文件数 too many open files 解决方法

    linux 打开文件数 too many open files 解决方法 too many open files 出现这句提示的原因是程序打开的文件/socket连接数量超过系统设定值. 查看每个用户 ...

  5. 在Linux最大打开文件数限制下 MySQL 对参数的调整

    http://www.actionsky.com/docs/archives/78  2016年4月7日  周文雅 目录 1 起因 2 说明 3 MySQL调整参数的方式 3.1 计算 request ...

  6. 放开Linux内核对用户进程可打开文件数和TCP连接的限制

    一. 检查linux内核uname -alsb_release -a 二. 用户进程可打开文件数限制1) vim /etc/security/limits.conf*       -      nof ...

  7. linux系统工程师修改打开文件数限制代码教程。服务器运维技术

    提示linux文件打开错误,修改linux打开文件数参数. /etc/pam.d/login 添加 session required /lib/security/pam_limits.so 注意看这个 ...

  8. 调整Linux最大打开文件数

    #!/bin/bash ## 文件数限制 ulimit -n ulimit -Sn ulimit -Hn ## fs.nr_open,进程级别 ## fs.file-max,系统级别 ## 最大文件描 ...

  9. linux打开文件数测试

    /proc/sys/kernel/threads-max 系统最大线程数量 /proc/sys/vm/max_map_count 限制一个进程可以拥有的VMA(虚拟内存区域)的数量 /proc/sys ...

随机推荐

  1. 【转】vi 写完文件保存时才发现是 readonly

    在MAC上编辑apache配置文件,老是忘记sudo…… readonly的文件保存时提示 add ! to override, 但这仅是对root来说的啊! 百毒了一下竟然还有解决方案!! :w ! ...

  2. BZOJ4912 [Sdoi2017]天才黑客 【虚树 + 最短路】

    题目链接 BZOJ4912 题解 转移的代价是存在于边和边之间的 所以把边看做点,跑最短路 但是这样做需要把同一个点的所有入边和所有出边之间连边 \(O(m^2)\)的连边无法接受 需要优化建图 膜一 ...

  3. Problem A: 踢罐子 解题报告

    Problem A: 踢罐子 Description 平面上有\(n\)个点,其中任意2点不重合,任意3点不共线. 我们等概率地选取一个点A,再在剩下的\(n-1\)个点中等概率地选取一个点B,再在剩 ...

  4. jQuery EasyUI API 中文文档 - 消息框(Messager)

    http://www.cnblogs.com/Philoo/archive/2011/11/15/jeasyui_api_messager.html Messager  消息框 博客园 风流涕淌 (p ...

  5. JAVA (字符串学习)

    String类 String类是不可改变的,所以你一旦创建了String对象,那它的值就无法改变了. 如果需要对字符串做很多修改,那么应该选择使用StringBuffer&StringBuil ...

  6. oracle connect by用法篇 (转)

    1.基本语法 select * from table [start with condition1] connect by [prior] id=parentid 1 2 1 2 一般用来查找存在父子 ...

  7. 【DS】排序算法之插入排序(Insertion Sort)

    一.算法思想 一般来说,插入排序都采用in-place在数组上实现.具体算法描述如下:1)从第一个元素开始,该元素可以认为已经被排序2)取出下一个元素,在已经排序的元素序列中从后向前扫描3)如果该元素 ...

  8. HDU 3595 every-sg模型

    多个子游戏同时进行,每个子游戏给出两个数a,b,可以将大的数减去k倍小的数,不能操作者输. 策略就是对于一个必胜的游戏要使得步数更长,对于一个必败的游戏使得步数最短. 以下都来自贾志豪的论文.. 对于 ...

  9. Windows系统安装————windows7 企业版 无法安装 NET.framework4.52-4.6版本在WIN7下解决办法

    官方安装包下载地址:https://www.microsoft.com/zh-cn/download/details.aspx?id=48137 我安装了NMM后提示NET.framework版本太低 ...

  10. 流媒体服务器之————EasyDarwin开源流媒体服务器:编译、配置、部署

    源码下载地址:https://github.com/EasyDarwin/EasyDarwin/archive/v7.0.5.zip 查看 Ubuntu 的版本号 sudo lsb_release - ...