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 这个目录结构介绍是我目前看到介绍最全的,有时间在翻译 ...
随机推荐
- appium中从activity切换到html
问题:混合开发的app中,会有内嵌的H5页面元素,该如何进行定位操作? 解决思路:appium中的元素定位都是基于android原生控件进行元素定位,而web网页是B/S架构,两者运行环境不同需要进行 ...
- yield and send的使用详细解释
https://blog.csdn.net/mieleizhi0522/article/details/82142856 虽然并不完全正确,但是能在使用中帮我们拨开迷雾 再结合另外一篇文章理解了htt ...
- ORA-00054: 资源正忙 --锁表的解决方法
问题描述 ORA-00054: 资源正忙, 但指定以 NOWAIT 方式获取资源, 或者超时失效 发生异常 原因:其他Session已经对目标表做了操作,且未提交操作,导致锁表,新的Session无法 ...
- ZT:在mybatis的Mapping文件写入表名 出现异常ORA-00903: 表名无效 的解决
简而言之,把#{tablename}换成${tablename}就能解决问题. 版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:htt ...
- 解决DBGridEh遍历记录后不移动当前行位置的方法
解决DBGridEh遍历记录后不移动当前行位置的方法 在用DBGridEh配合ClientDataSet使用时,需要知道用户选择了哪些记录,可用遍历记录的方法查询选择列是否为真,但在这之后,Clien ...
- centos7安装kvm及kvm管理
一.安装kvm 查看CPU是否支持虚拟化 grep -E 'svm|vmx' /proc/cpuinfo - vmx is for Intel processors - svm is for AMD ...
- k8s nginx-ingress 504 timeout
nginx ingress 报错 504 timeout,是由于反向代理超时造成的,反向代理默认超时时间60s 官方文档 配置片段: apiVersion: extensions/v1beta1 ki ...
- Leetcode之动态规划(DP)专题-121. 买卖股票的最佳时机(Best Time to Buy and Sell Stock)
Leetcode之动态规划(DP)专题-121. 买卖股票的最佳时机(Best Time to Buy and Sell Stock) 股票问题: 121. 买卖股票的最佳时机 122. 买卖股票的最 ...
- 【VS开发】程序员对内存的理解
程序员对内存的理解 在C和C++语言开发中,指针.内存一直是学习的重点.因为C语言作为一种偏底层的中低级语言,提供了大量的内存直接操作的方法,这一方面使程序的灵活度最大化,同时也为bug埋下很多隐患. ...
- ES6中Set和Map
1.Set 实例的创建 Set实例它类似于数组,但是成员的值都是唯一的,没有重复的值. Set本身是一个构造函数用来生成Set数据结构. Set 函数可以接受一个数组(或者具有 iterable 接口 ...