<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://www.jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://www.jackxiang.com/post//</link>
<title><![CDATA[[值得实践]centos修改用户进城数和句柄数，修改linux的最大文件句柄数限制 (Too many open files)。]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Unix/LinuxC技术]]></category>
<pubDate>Mon, 24 Jun 2013 13:33:27 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	lsof -n&#124;awk &#039;&#123;print $2&#125;&#039;&#124;sort&#124;uniq -c&#124;sort -nr&#124;more<br/>其中第一列是打开的句柄数，第二列是进程ID。可以根据ID号来查看进程名:<br/>ps aef&#124;grep 24204<br/><br/>是当前生效还是全局，http://www.linuxde.net/2013/03/13045.html<br/><br/>分析这段代码可以知道先读/etc/security/limits.conf，如果/etc/security/limits.d/目录下还有配置文件的话，也读进来，一起分析。这就意味/etc/security/limits.d/里面的文件里面的配置会覆盖/etc/security/limits.conf的配置。<br/><br/><br/>  一般在/etc/security/limits.conf 中修改最大打开文件数和进程数，如：<br/>    * soft noproc 102400<br/>    * hard noproc 102400<br/>    * soft nofile 102400<br/>    * hard nofile 102400<br/>    但是在centos 6.3下，方法不一样了<br/>    首先在/etc/security/limits.conf中修改最大文件数和进程数<br/>    *   soft   nofile   102400<br/>    <br/>    *   hard  nofile   102400<br/>  <br/>    然后在/etc/security/limits.d/90-nproc.conf中修改最大文件数和进程数<br/>    *   soft   nproc   102400<br/>    *   hard  nproc   102400<br/>  <br/><br/><br/>linux 打开文件句柄时可能出现“Too many open files”的提示，可以修改linux的最大文件句柄数限制：<br/>1）ulimit -n 65535&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;在当前session有效，用户退出或者系统重新后恢复默认值<br/><br/>2）修改profile文件：在profile文件中添加：ulimit -n 65535&nbsp;&nbsp;<br/>&nbsp;&nbsp; 只对当个用户有效<br/><br/>3）修改文件：/etc/security/limits.conf，在文件中添加：（立即生效-当前session中运行ulimit -a命令无法显示）<br/>&nbsp;&nbsp;* soft nofile 32768 #限制单个进程最大文件句柄数（到达此限制时系统报警）&nbsp;&nbsp;<br/>&nbsp;&nbsp;* hard nofile 65536&nbsp;&nbsp;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;使用通配符*表示所有用户,*号可以换成具体的用户名或者用户组的名称。<br/>&nbsp;&nbsp;&nbsp;&nbsp;这个文件里的限制对root以外的用户在新登陆是立即生效，不用reboot。<br/>&nbsp;&nbsp;&nbsp;&nbsp;soft 指的是当前系统生效的设置值。hard 表明系统中所能设定的最大值。soft 的限制不能比har 限制高。用 - 就表明同时设置了 soft 和 hard 的值。<br/>&nbsp;&nbsp;&nbsp;&nbsp;nofile - 打开文件的最大数目, noproc - 进程的最大数目<br/><br/>4）修改文件：/etc/sysctl.conf。在文件中添加：<br/>&nbsp;&nbsp;&nbsp;&nbsp;fs.file-max=655350 #限制整个系统最大文件句柄数&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;运行命令：/sbin/sysctl -p 使配置生效<br/><br/>来自：http://blog.csdn.net/chid/article/details/8812746
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] [值得实践]centos修改用户进城数和句柄数，修改linux的最大文件句柄数限制 (Too many open files)。]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>