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

$ 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. Python 使用multiprocessingm模块创建多进程

    from multiprocessing import Process def run_proc(name): print("子进程Process %s(%s)运行..."%(na ...

  2. GDKOI2018发烧记

    偏远小渔村NOIP螺旋升天选手又一次来到了广州参加GDKOI...金实的初三爷们也来啦?要被碾啦T T Day 0 跟HR Lao爷拼(biao)车到了高铁站,上了高铁居然没有颓颓颓吃吃吃(雾),安心 ...

  3. 界面编程之QT的基本介绍与使用20180722

    /*******************************************************************************************/ 一.qt介绍 ...

  4. SQL Server 提高执行效率的16种方法

    1.尽量不要在where中包含子查询; 关于时间的查询,尽量不要写成:where to_char(dif_date,'yyyy-mm-dd')=to_char('2007-07-01′,'yyyy-m ...

  5. JQuery中2个等号与3个等号的区别

    首先,== equality 等同,=== identity 恒等.==, 两边值类型不同的时候,要先进行类型转换,再比较.===,不做类型转换,类型不同的一定不等. 下面分别说明:先说 ===,这个 ...

  6. Codeforces 906 D. Power Tower

    http://codeforces.com/contest/906/problem/D 欧拉降幂 #include<cstdio> #include<iostream> usi ...

  7. bzoj千题计划200:bzoj3106: [cqoi2013]棋盘游戏

    http://www.lydsy.com/JudgeOnline/problem.php?id=3106 白棋如果第一步不能赢,那么一定输 因为可以黑棋走的距离比白棋大,黑棋可以下一步吃掉白棋,也可以 ...

  8. unp学习笔记——Chapter1

    1.发现网络拓扑的几个重要的命令 (1).netstat -i 提供网络接口的信息.我们还指定-n 标志以输出数值地址,而不是试图把它们反向解析成名字.netstat -r 展示路由表. dzhwen ...

  9. CF 1131B Draw!

    Draw! Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u   Descriptio ...

  10. vue需要注意的事宜

    1.Vue在进行点击事件的时候大部分是在标签上进行添加的,一般在标签上添加@click: 如果需要在组件上面进行点击事件的时候,直接写@click是木有变化的,需要在后面添加一个.native就如@c ...