Linux Too many open files
Linux Too many open files
查看系统资源限制信息:
sudo -s -u root -H id
sudo -s lsof | awk '{ print $2 " " $1; }' | sort -rn | uniq -c | sort -rn | head -20
sudo -s ulimit -Sn
sudo -s ulimit -Hn
sudo cat /proc/sys/fs/file-max
sudo -s cat /etc/security/limits.conf
最后当我们尝试$ cat /proc/<processId>/limits; 我们注意到“打开文件数”仍显示为4096,这是旧值; 虽然对于root来说它显示了更高的值。
最后,我们可以通过修改 /etc/default/tomcat7 [或与您的进程相对应的任何其他文件]并添加以下行来解决此问题:
ulimit -Hn 10000
ulimit -Sn 10000
无需重启系统; 只需重新启动进程,然后检查 cat /proc/<processId>/limits
在ubuntu 16.04下,tomcat的最大文件数受systemd限制,并自动设置为4096.您可以通过运行更改此值
systemctl edit tomcat7
添加以下行:
[Service]
LimitNOFILE=8192
或者你可以自己创建配置:
mkdir /etc/systemd/system/tomcat7.service.d/
nano /etc/systemd/system/tomcat7.service.d/override.conf
之后重新加载tomcat:
服务tomcat7重启
并仔细检查是否正确设置了限制
ps ax | grep tomcat
cat /proc/<processId>/limits
1. 使用以下行修改/etc/systemd/user.conf和/etc/systemd/system.conf(这将负责图形登录):
DefaultLimitNOFILE=65535
2. 使用以下行修改/etc/security/limits.conf(这将负责非GUI登录):
* hard nofile 65535
* soft nofile 65535
root hard nofile 65535
root soft nofile 65535
3. 可选操作,编辑 /etc/pam.d/common-session和/etc/pam.d/common-session-noninteractive 文件并添加以下行到最后:
session required pam_limits.so
4. 重新启动计算机以使更改生效。
No need to change anything in the /etc/security/limits.conf file, it is ignored if you are using systemd.
(reproducing a modified answer to another question on the network...)
An alternative for those who prefer not to edit the default /etc/systemd/system.conf and /etc/systemd/user/conf files:
create a new file
/etc/systemd/system.conf.d/limits.confwith these contents:[Manager]
DefaultLimitNOFILE=65535
run
systemctl daemon-reexecas rootlogout and login again
check your new limit with
ulimit -n.
Refer to the systemd-system.conf manpage for details.
System.IO.IOException: Too Many Open Files (Mono .NET on Ubuntu)
sudo ps -waux | grep mono | grep -v grep | awk '{print $2}' | xargs kill -9
export MONO_MANAGED_WATCHER=disabled
================ End
Linux Too many open files的更多相关文章
- 【原】The Linux Command Line - Manipulation Files And Directories
cp - Copy Files and directories mv - move/rename files and directories mkdir - create directories rm ...
- Linux Compile Multiple C++ Files
Compile Two Files: $ CC -c Main.cc Sales_item.cc # by default generates a.exe # some compilers gener ...
- linux find string in files
http://blog.csdn.net/duguduchong/article/details/7716908 查找目录下的所有文件中是否含有某个字符串 find .|xargs grep -ri ...
- linux too many open files 问题总结
问题描述: kubernetes 集群使用promtail收集日志,发现一段时间有些机器日志收集不到查看promtail日志出现以下报错: error="filetarget.fsnotif ...
- linux too many open files报错
修改方法:vi /etc/security/limits.conf 增加一行,如下: * - nofile 65535 修改vi /etc/ssh/sshd ...
- linux修改open files数
概要 linux系统默认open files数目为1024, 有时应用程序会报Too many open files的错误,是因为open files 数目不够.这就需要修改ulimit和file-m ...
- [转载]linux修改open files数
概要:linux系统默认open files数目为1024, 有时应用程序会报Too many open files的错误,是因为open files 数目不够.这就需要修改ulimit和file-m ...
- Linux服务器报错too many open files错误解决方案
1.本质解决方案按照oracle的安装脚本中以下几项文件进行相应配置: cp /etc/security/limits.conf /etc/security/limits.conf.bak echo ...
- linux -目录结构
摘自:http://www.comptechdoc.org/os/linux/usersguide/linux_ugfilestruct.html 这个目录结构介绍是我目前看到介绍最全的,有时间在翻译 ...
随机推荐
- 关于本电脑qt5.11+vs2017+opencv3.4的配置问题
本人想用qt5.11+vs2017+opencv3.4开发程序,配置了很久才成功,现在把配置后的环境变量记录一下,以供自己以后参考,同时也供大家参考. qt5.11+vs2017+opencv3.4的 ...
- 前端知识点回顾——Javascript篇(三)
数组的冒泡.选择和插入排序法 冒泡排序法(从小到大) function bubble(arr){ for(let i = 0 ;i<arr.length-1;i++){ for(let j = ...
- springboot 获取控制器参数的几种方式
这里介绍springboot 获取控制器参数有四种方式 1.无注解下获取参数 2.使用@RequestParam获取参数 3.传递数组 4.通过URL传递参数 无注解下获取参数无注解下获取参数,需要控 ...
- Win10+VS2017配置pthread
0.pthread源码下载:https://sourceware.org/pthreads-win32/ 1.下载pthreads-w32-2-9-1-release.zip完毕后,解压,内容如下 其 ...
- java中使用MappedByteBuffer将 File类转ByteBuffer
public static WavFile openWavFile(File file) throws IOException, WavFileException { FileChannel chan ...
- Spring-Kafka —— 消费如何达到最高的吞吐量
首先简单的介绍一下消费者对topic的订阅.客户端的消费者订阅了topic后,如果是单个消费者,那么消费者会顺序消费这些topic分区中的数据,如果是创建了消费组有多个消费者,那么kafak的服务端将 ...
- .Net Core 2.*+ InfluxDB+Grafana+App Metrics实时性能监控
前言 .net core 2.* 实施性能监控 这个工具其实给运维 大大们用起来是更爽的.但是Grafana现在还没有找到中文版. 本文需要了解的相关技术与内容: InfluxDb(分布式时序数据库, ...
- BUGKU (Mountain climbing)
UPX壳,手脱后打不开,可能是在windows10脱壳的缘故吧.放在XP虚拟机上手脱可能会好,但是提示缺少dll.无奈,智能用工具了. 用的这个,感觉蛮好用的. 先打开程序.随便输入一个数,提示err ...
- LeetCode.1175-质数排列(Prime Arrangements)
这是小川的第413次更新,第446篇原创 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第264题(顺位题号是1175).返回1到n的排列数,以使质数处于质数索引(索引从1开始).(请 ...
- java使用validator进行校验
不管是html页面表单提交的对象数据还是和第三方公司进行接口对接,都需要对接收到的数据进行校验(非空.长度.格式等等).如果使用if一个个进行校验(字段非常多),这是让人崩溃的过程.幸好jdk或hib ...