(转)linux 打开文件数 too many open files 解决方法
too many open files
出现这句提示的原因是程序打开的文件/socket连接数量超过系统设定值。
查看每个用户最大允许打开文件数量
ulimit -a
- fdipzone@ubuntu:~$ ulimit -a
- core file size (blocks, -c) 0
- data seg size (kbytes, -d) unlimited
- scheduling priority (-e) 20
- file size (blocks, -f) unlimited
- pending signals (-i) 16382
- max locked memory (kbytes, -l) 64
- max memory size (kbytes, -m) unlimited
- open files (-n) 1024
- pipe size (512 bytes, -p) 8
- POSIX message queues (bytes, -q) 819200
- real-time priority (-r) 0
- stack size (kbytes, -s) 8192
- cpu time (seconds, -t) unlimited
- max user processes (-u) unlimited
- virtual memory (kbytes, -v) unlimited
- file locks (-x) unlimited
其中 open files (-n) 1024 表示每个用户最大允许打开的文件数量是1024
查看当前系统打开的文件数量
- lsof | wc -l
- watch "lsof | wc -l"
查看某一进程的打开文件数量
- lsof -p pid | wc -l
- lsof -p 1234 | wc -l
设置open files数值方法
ulimit -n 2048
- fdipzone@ubuntu:~$ ulimit -n 2048
- fdipzone@ubuntu:~$ ulimit -a
- core file size (blocks, -c) 0
- data seg size (kbytes, -d) unlimited
- scheduling priority (-e) 20
- file size (blocks, -f) unlimited
- pending signals (-i) 16382
- max locked memory (kbytes, -l) 64
- max memory size (kbytes, -m) unlimited
- open files (-n) 2048
- pipe size (512 bytes, -p) 8
- POSIX message queues (bytes, -q) 819200
- real-time priority (-r) 0
- stack size (kbytes, -s) 8192
- cpu time (seconds, -t) unlimited
- max user processes (-u) unlimited
- virtual memory (kbytes, -v) unlimited
- file locks (-x) unlimited
这样就可以把当前用户的最大允许打开文件数量设置为2048了,但这种设置方法在重启后会还原为默认值。
永久设置方法
vim /etc/security/limits.conf
在最后加入
* soft nofile 4096
* hard nofile 4096
最前的 * 表示所有用户,可根据需要设置某一用户,例如
fdipzone soft nofile 8192
fdipzone hard nofile 8192
改完后注销一下就能生效。
转自:https://blog.csdn.net/fdipzone/article/details/34588803
(转)linux 打开文件数 too many open files 解决方法的更多相关文章
- linux 打开文件数 too many open files 解决方法
linux 打开文件数 too many open files 解决方法 too many open files 出现这句提示的原因是程序打开的文件/socket连接数量超过系统设定值. 查看每个用户 ...
- linux 打开文件数too many open files解决方法
出现这句提示的原因是程序打开的文件/socket连接数量超过系统设定值.查看每个用户最大允许打开的文件数量ulimit -a 其中 open files (-n) 1024 表示每个用户最大允许打开的 ...
- 遇到问题----linux-----linux 打开文件数 too many open files 解决方法
在运行某些命令或者 tomcat等服务器持续运行 一段时间后可能遇到 too many open files. 出现这句提示的原因是程序打开的文件/socket连接数量超过系统设定值. 查看每个用 ...
- linux上备份Oracle时EXP-00091的错误解决方法
unix/linux上备份Oracle时EXP-00091的错误解决方法 unix/linux上备份数据时的错误解决方法 EXP-00091: Exporting questionable stati ...
- linux找不到动态链接库 .so文件的解决方法(转自:http://www.cnblogs.com/xudong-bupt/p/3698294.html)
linux找不到动态链接库 .so文件的解决方法 如果使用自己手动生成的动态链接库.so文件,但是这个.so文件,没有加入库文件搜索路劲中,程序运行时可能会出现找不到动态链接库的情形. 可以通过ldd ...
- Linux使用退格键时出现^H ^?解决方法
Linux使用退格键时出现^H ^?解决方法 在linux下执行脚本不注意输错内容需要删除时总是出现^H ^H不是H键的意思,是backspace.主要是当你的终端backspace有问题的时候才需要 ...
- linux找不到动态链接库 .so文件的解决方法
linux找不到动态链接库 .so文件的解决方法 如果使用自己手动生成的动态链接库.so文件,但是这个.so文件,没有加入库文件搜索路劲中,程序运行时可能会出现找不到动态链接库的情形. 可以通过ldd ...
- 误把Linux运行级别设置为6后的解决方法【转】
本文转载自:http://www.wuji8.com/meta/841011126.html 误把Linux运行级别设置为6后的解决方法 我们知道,Linux有7个运行级别,而运行级别设置为6 ...
- 关于Linux服务器磁盘空间占满问题的解决方法
下面给大家分享一篇关于Linux服务器磁盘占满问题解决方法(/dev/sda3 满了),需要的的朋友参考下吧 下面我们一起来看一篇关于Linux服务器磁盘占满问题解决(/dev/sda3 满了), ...
随机推荐
- Oracle 优化器
http://blog.csdn.net/it_man/article/details/8185370一.优化器基本知识 Oracle在执行一个SQL之前,首先要分析一下语句的执行计划,然后再按执 ...
- JSP简单练习-用Servlet获取表单数据
// javaBean代码 package servlet; import java.io.*; import javax.servlet.*; import javax.servlet.http.* ...
- (LeetCode)两个链表的第一个公共节点
LeetCode上面的题目例如以下: Write a program to find the node at which the intersection of two singly linked l ...
- Codeforces Round #263 (Div. 2) proB
题目: B. Appleman and Card Game time limit per test 1 second memory limit per test 256 megabytes input ...
- php的特殊功能-----不是和其他语言比较
1.header(); 他不只是重定向,和更改字符集 而是发送表头,如 header('HTTP/1.1 404 Not Found gfdgd'); 可以发送信息给浏览器,让浏览器显示404错误 ...
- Android中BaseAdapter使用基础点
Android中要填充一些控件(如ListView)经常须要用到Adapter来实现,经常使用的有ArrayAdapter,SimpleAdapter, CursorAdapter,BaseAdapt ...
- IOS - unity3d错误Could not produce class with ID
运行环境 Unity 5.3.5f1 (IL2CPP)编译IOS版本 XCode Version 7.2.1 (7C1002) Mac OS X 10.11.3 (15D21) (Mac mini) ...
- map和string的使用方法
这个是别人写的map使用方法比較好能够看一下 http://www.cnblogs.com/anywei/archive/2011/10/27/2226830.html 怎样向数组中插入内容 http ...
- Android中RelativeLayout各个属性及其含义
android:layout_above="@id/xxx" --将控件置于给定ID控件之上android:layout_below="@id/xxx" - ...
- CAS实现单点登录理解
CAS 是 Yale 大学发起的一个企业级的.开源的项目,旨在为 Web 应用系统提供一种可靠的单点登录解决方法(属于 Web SSO ),CAS 开始于 2001 年, 并在 2004 年 12 月 ...