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.conf
with these contents:[Manager]
DefaultLimitNOFILE=65535
run
systemctl daemon-reexec
as 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 这个目录结构介绍是我目前看到介绍最全的,有时间在翻译 ...
随机推荐
- PHP-生产随机验证码图片
// <span style="white-space:pre"> </span>//因为要把产生的验证码保存到session中,此处为session开始 ...
- cucumber+testng
执行顺序 beforeSuite in RunnerForInt beforeSuite in RunnerForString beforeTest in RunnerForInt beforeTes ...
- Vue UI组件 开发框架 服务端 辅助工具 应用实例 Demo示例
Vue UI组件 开发框架 服务端 辅助工具 应用实例 Demo示例 element ★11612 - 饿了么出品的Vue2的web UI工具套件 Vux ★7503 - 基于Vue和WeUI的组件库 ...
- 使用redis防止重复提交
使用redis防止重复提交 其实主要思路是他的https://blog.csdn.net/u013378306/article/details/52944780 主要目前我的情况是,前后端分离的, ...
- spring cloud consul上下线体验
spring cloud consul中默认会将spring.application.name作为ID 同一服务起多个实例时,ID默认会变成${spring.application.name}-${s ...
- MapUtils演示
org.apache.commons.collections.MapUtils工具类演示 maven pom.xml配置 <dependency> <groupId>org.a ...
- Spring-Kafka —— 消费后不提交offset情况的分析总结
最近在使用kafka,过程中遇到了一些疑问,在查阅了一些资料和相关blog之后,关于手动提交offset的问题,做一下总结和记录. 消费端手动提交offset代码如下: /** * 这是手动提交的消费 ...
- jenkins配置记录
jenkins配置记录 http://www.cnblogs.com/kevingrace/p/6022447.html
- ProbCog[github]使用心得
1. After installing ProbCog,you can run blnquery and mlnquery. If the terminal warns that 'command n ...
- wdScrollTab
wdScrollTab是一个采用jQuery实现的Tab面板,当标签太多超出页面时会自动滚动.支持iframe.ajax调用和动态加载内容.