2014年9月13日星期六

linux:解决too many open files错误

一大早被叫起来解决故障,悲催啊。就是因为机器设置的max open files太小了,一会就不够了。
登上机器,一看:ulimit -n,结果只有1024. 好吧,临时解决方案:ulimit -n 409600,注意这个命令只对当前shell有效,所以修改后要在当前shell重启进程。
后来运维上线来搞了,方法记录一下:
/etc/security/limits.conf
加上:
* soft nofile 65535
* hard nofile 65535
就ok了。