<?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/4937/</link>
<title><![CDATA[解决 Mysql 错误日志出现 Error in accept: Too many open files]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[WEB2.0]]></category>
<pubDate>Tue, 31 Jan 2012 09:47:26 +0000</pubDate> 
<guid>http://www.jackxiang.com/post/4937/</guid> 
<description>
<![CDATA[ 
	&nbsp;&nbsp; 个人的博客的mysql服务down掉，查看日志，日志中出现了这样的错误提示：<textarea name="code" class="html" rows="15" cols="100">
120129 15:13:56 [ERROR] Error in accept: Too many open files
120131 14:56:16 [ERROR] /usr/local/webserver/mysql/bin/mysqld: Can&#039;t open file: &#039;./jackxiang_mysql/boblog_links.frm&#039; (errno: 24
)
</textarea><br/>一查才知道是因为open files的原因，linux 系统默认的opens file是1024，可以使用ulimit -a 查看,这个是系统级的限制。另外在mysql中默认的open files也是1024，所以要同时调整这两个参数才可以。如何调整呢？<br/><br/>一、调整系统级的open files:<br/><br/>打开vi /etc/security/limits.conf文件：在文件里添加一行：* – nofile 4096，这样就把open files调整到了4096。<br/><br/>二、调整mysql的open files:<br/><br/>打开vi /etc/my.cnf文件，在[mysqld]段中添加一行：open_files_limit = 4096，重启mysql即可！<br/><br/>修改：/etc/my.cnf<br/>[[root@test0001 ~]# vi /etc/my.cnf<br/>[mysqld]<br/>open_files_limit = 30000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>重启 mysqld<br/>service mysqld restart<br/>再次查看：<br/>mysql&gt; show global variables like &#039;%open%&#039;;<br/>+------------------+-------+<br/>&#124; Variable_name&nbsp;&nbsp;&nbsp;&nbsp;&#124; Value &#124;<br/>+------------------+-------+<br/>&#124; have_openssl&nbsp;&nbsp;&nbsp;&nbsp; &#124; NO&nbsp;&nbsp;&nbsp;&nbsp;&#124;<br/>&#124; open_files_limit &#124; 30000 &#124;<br/>&#124; table_open_cache &#124; 2048&nbsp;&nbsp;&#124;<br/>+------------------+-------+<br/>3 rows in set (0.00 sec)&nbsp;&nbsp;&nbsp;&nbsp; <br/>至此问题解决！<br/><br/><br/>附录：<br/>open_files_limit&nbsp;&nbsp;这个数字少了点，这里有个算法：<br/>max_open_files_1 = max_connections + table_cache * 2 = 100 + 1000 * 2 = 2100<br/>max_open_files_2 = max_connections*5 = 100 * 5 = 500
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post/4937/#blogcomment63435</link>
<title><![CDATA[[评论] 解决 Mysql 错误日志出现 Error in accept: Too many open files]]></title> 
<author>hxngb8kf &lt;tvzc01@mail114.net&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Wed, 15 Feb 2012 17:29:12 +0000</pubDate> 
<guid>http://www.jackxiang.com/post/4937/#blogcomment63435</guid> 
<description>
<![CDATA[ 
	楼主说得好，支持一下
]]>
</description>
</item>
</channel>
</rss>