<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MySQL实践积累 &#187; MySQL</title>
	<atom:link href="http://dbahacker.com/archive/mysql/feed" rel="self" type="application/rss+xml" />
	<link>http://dbahacker.com</link>
	<description></description>
	<lastBuildDate>Wed, 01 Feb 2012 07:48:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>MySQL group by with rollup的用法</title>
		<link>http://dbahacker.com/mysql/mysql-group-by-with-rollup%e7%9a%84%e7%94%a8%e6%b3%95</link>
		<comments>http://dbahacker.com/mysql/mysql-group-by-with-rollup%e7%9a%84%e7%94%a8%e6%b3%95#comments</comments>
		<pubDate>Wed, 01 Feb 2012 07:48:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://dbahacker.com/?p=219</guid>
		<description><![CDATA[有一位同学通过askdba来询问with rollup的用法 (2012-02-01 15:08:22): mysql中有这种用法select ... from table_name group by a with rollup &#34;with rollup&#34;是什么意思呢？ GROUP BY Modifiers&#160; 官方手册里面对这个rollup有一个专门的页面介绍 地址在这里，说得非常详细，我这里做一个简单的例子重现 建一个简单的表并插入几条简单的数据 CREATE TABLE `t` ( `id` int(11) DEFAULT NULL, `id2` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=gbk insert into t valeu(11,11),(12,12),(13,13); 先来做一个查询 root@test 03:44:32&#62;select id,sum(id2),avg(id2) from t group by id with rollup; +------+----------+----------+ &#124; id [...]]]></description>
			<content:encoded><![CDATA[<p>有一位同学通过askdba来询问with rollup的用法</p>
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 600px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">(2012-02-01 15:08:22):
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> mysql中有这种用法select ... from table_name  group by a with rollup
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">&quot;<span style="color: #8b0000">with rollup</span>&quot;是什么意思呢？
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"></pre>
</pre>
<p>GROUP BY Modifiers&#160; 官方手册里面对这个rollup有一个专门的页面介绍 <a href="http://dev.mysql.com/doc/refman/5.5/en/group-by-modifiers.html" target="_blank">地址在这里</a>，说得非常详细，我这里做一个简单的例子重现</p>
<p>建一个简单的表并插入几条简单的数据</p>
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 600px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">CREATE TABLE `t` (
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  `id` <span style="color: #0000ff">int</span>(11) DEFAULT NULL,
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  `id2` <span style="color: #0000ff">int</span>(11) DEFAULT NULL
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">) ENGINE=InnoDB DEFAULT CHARSET=gbk
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">insert into t valeu(11,11),(12,12),(13,13);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"></pre>
</pre>
<p>先来做一个查询</p>
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 600px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">root@test 03:44:32&gt;select id,sum(id2),avg(id2) from t group by id with rollup;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">+------+----------+----------+
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">| id   | sum(id2) | avg(id2) |
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">+------+----------+----------+
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">|   11 |       11 |  11.0000 |
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">|   12 |       12 |  12.0000 |
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">|   13 |       13 |  13.0000 |
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">| NULL |       36 |  12.0000 |
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">+------+----------+----------+
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">4 rows in set (0.00 sec)</pre>
</pre>
<p>我们可以看到，对于group by的列，with rollup将不会做任何的操作，而是返回一个NULL，而没有group by的列，则根据前面的avg函数和sum函数做了处理。 </p>
<p>再来看另外一个语句，只对一个列做avg</p>
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 600px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">root@test 03:44:36&gt;select id,avg(id2) from t group by id with rollup;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">+------+----------+
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">| id   | avg(id2) |
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">+------+----------+
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">|   11 |  11.0000 |
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">|   12 |  12.0000 |
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">|   13 |  13.0000 |
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">| NULL |  12.0000 |
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">+------+----------+
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">4 rows in set (0.00 sec)</pre>
</pre>
<p>以前从没留意到有这种用法，这次长见识了。 </p>
]]></content:encoded>
			<wfw:commentRss>http://dbahacker.com/mysql/mysql-group-by-with-rollup%e7%9a%84%e7%94%a8%e6%b3%95/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL 5.0 5.1 下InnoDB的预热方法</title>
		<link>http://dbahacker.com/mysql/mysql-5-0-5-1-%e4%b8%8binnodb%e7%9a%84%e9%a2%84%e7%83%ad%e6%96%b9%e6%b3%95</link>
		<comments>http://dbahacker.com/mysql/mysql-5-0-5-1-%e4%b8%8binnodb%e7%9a%84%e9%a2%84%e7%83%ad%e6%96%b9%e6%b3%95#comments</comments>
		<pubDate>Tue, 05 Oct 2010 07:13:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[InnoDB]]></category>
		<category><![CDATA[MySQL5.0]]></category>
		<category><![CDATA[MySQL5.1]]></category>

		<guid isPermaLink="false">http://dbahacker.com/?p=150</guid>
		<description><![CDATA[asdfsdfsadf0.00 creates/s, 0.00 writes/s Buffer pool hit rate 757 / 1000 &#8212;&#8212;&#8212;&#8212;&#8211; ROW OPERATIONS &#8212;&#8212;&#8212;&#8212;&#8211; 0 queries inside InnoDB, 0 queries in queue 1 read views open inside InnoDB Main thread process no. 12487, id 1157658976, state: waiting for server activity Number of rows inserted 0, updated 0, deleted 0, read 21 0.00 inserts/s, 0.00 [...]]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste" style="position: absolute; overflow-x: hidden; overflow-y: hidden; width: 1px; height: 1px; top: 0px; left: -10000px;">asdfsdfsadf0.00 creates/s, 0.00 writes/s</div>
<div id="_mcePaste" style="position: absolute; overflow-x: hidden; overflow-y: hidden; width: 1px; height: 1px; top: 0px; left: -10000px;">Buffer pool hit rate 757 / 1000</div>
<div id="_mcePaste" style="position: absolute; overflow-x: hidden; overflow-y: hidden; width: 1px; height: 1px; top: 0px; left: -10000px;">&#8212;&#8212;&#8212;&#8212;&#8211;</div>
<div id="_mcePaste" style="position: absolute; overflow-x: hidden; overflow-y: hidden; width: 1px; height: 1px; top: 0px; left: -10000px;">ROW OPERATIONS</div>
<div id="_mcePaste" style="position: absolute; overflow-x: hidden; overflow-y: hidden; width: 1px; height: 1px; top: 0px; left: -10000px;">&#8212;&#8212;&#8212;&#8212;&#8211;</div>
<div id="_mcePaste" style="position: absolute; overflow-x: hidden; overflow-y: hidden; width: 1px; height: 1px; top: 0px; left: -10000px;">0 queries inside InnoDB, 0 queries in queue</div>
<div id="_mcePaste" style="position: absolute; overflow-x: hidden; overflow-y: hidden; width: 1px; height: 1px; top: 0px; left: -10000px;">1 read views open inside InnoDB</div>
<div id="_mcePaste" style="position: absolute; overflow-x: hidden; overflow-y: hidden; width: 1px; height: 1px; top: 0px; left: -10000px;">Main thread process no. 12487, id 1157658976, state: waiting for server activity</div>
<div id="_mcePaste" style="position: absolute; overflow-x: hidden; overflow-y: hidden; width: 1px; height: 1px; top: 0px; left: -10000px;">Number of rows inserted 0, updated 0, deleted 0, read 21</div>
<div id="_mcePaste" style="position: absolute; overflow-x: hidden; overflow-y: hidden; width: 1px; height: 1px; top: 0px; left: -10000px;">0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.07 reads/s</div>
<div id="_mcePaste" style="position: absolute; overflow-x: hidden; overflow-y: hidden; width: 1px; height: 1px; top: 0px; left: -10000px;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</div>
<div id="_mcePaste" style="position: absolute; overflow-x: hidden; overflow-y: hidden; width: 1px; height: 1px; top: 0px; left: -10000px;">END OF INNODB MONITOR OUTPUT</div>
<div id="_mcePaste" style="position: absolute; overflow-x: hidden; overflow-y: hidden; width: 1px; height: 1px; top: 0px; left: -10000px;">==========================MyS</div>
<p>之前在做一个项目的MySQL数据库极限压测, 有部分场景是涉及到MySQL重启的,而这个项目使用的是InnoDB存储引擎。</p>
<p>重启完毕后,一开始十几分钟的性能是非常差的,原因是因为InnoDB有innodb buffer pool(简称ibf)的概念</p>
<p>和innodb buffer pool相关的参数innodb_buffer_pool_size,size越大,可以放到内存的数据越多,而大多数的项目都会有热点数据的存在,当热点数据经过LRU算法进入到buffer pool之后,读磁盘的次数减少,读的都是内存,速度是最快的</p>
<p>问题来了,数据库一重启,热点数据都被清空,bf里面都是空的.等待app的sql请求过来让bf填满数据是一个方法,但30分钟内很难把热点数据都装载进来.</p>
<p>这个时候,我们可以采取人工预热的办法来让bf满足我们的需求</p>
<p><strong>MySQL 5.0的预热是最简单的</strong></p>
<p>方法1 : 在MySQL重启后 执行 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES,经过我在一台5.0MySQL的实验 在重启后查看show innodb status\G 和执行完这条语句后 Free buffers的页数会减少.</p>
<p>这个count语句有何作用呢?InnoDB的存储格式和MyISAM不一样, innodb会在mysql启动后的第一次访问表的时候,统计表的索引基数等相关信息,如果表很多的话,这也是一个巨大的开销.所以在正式提供服务之前,就把表打开,放入到bp里面</p>
<p><strong>MySQL 5.1的数据预热</strong></p>
<p>我在一台5.1.48的MySQL进行了重启,测试了同样的SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES 但发现free buffers的页数没有变少，情况和mysqlperformanceblog.com作者所说的一样&#8211;这个方法在5.1之后就无法达到我们的需求了</p>
<p>可以采用另外一种方法:获得数据库里面的库和对应的表，来进行预热，核心代码是这一句</p>
<p>SELECT table_schema, table_name FROM information_schema.tables</p>
<p>可以用perl或者python来获取库和表 然后执行 select * from db.table limit 1 来实现我们的方法</p>
<p>最后提一下,我们可以再my.cnf 加入init-file=/mysql/init.sql ，在每次mysql重启的时候就自动执行这个预热的sql  当然了 sql是要我们自己生成的哦</p>
]]></content:encoded>
			<wfw:commentRss>http://dbahacker.com/mysql/mysql-5-0-5-1-%e4%b8%8binnodb%e7%9a%84%e9%a2%84%e7%83%ad%e6%96%b9%e6%b3%95/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MySQL InnoDB 崩溃恢复过程  前言</title>
		<link>http://dbahacker.com/mysql/mysql-innodb-%e5%b4%a9%e6%ba%83%e6%81%a2%e5%a4%8d%e8%bf%87%e7%a8%8b-%e5%89%8d%e8%a8%80</link>
		<comments>http://dbahacker.com/mysql/mysql-innodb-%e5%b4%a9%e6%ba%83%e6%81%a2%e5%a4%8d%e8%bf%87%e7%a8%8b-%e5%89%8d%e8%a8%80#comments</comments>
		<pubDate>Thu, 09 Sep 2010 01:02:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://dbahacker.com/?p=134</guid>
		<description><![CDATA[最近一个正在进行的项目，性能测试场景中包含MySQL 为较大压力的应用程序提供服务，Linux服务器CPU占用100% ，OS 不可用，我写了一个吃CPU的shell脚本来不断的跑，结果把服务器跑挂了，手动重启了服务器后，发现MySQL起来的时间需要非常长，为大家所不能接受 MySQL相关信息   5.0.67    InnoDB Buffer Pool Size为36G  ,innodb_flush_log_at_trx_commit = 1，innodb_log_file_size = 900M ，当时候的服务器情况比较糟糕，CPU占用100% ，ssh也登录不进去，维持了一段时间后才进行重启，所以没有收集到最重要的崩溃之前的MySQL内部信息   整个的恢复过程用了6个小时 这个时候，引发了我们的反思: 1. 我们的MySQL压测模型没有针对不同版本的MySQL进行崩溃恢复压测  所以出现这个崩溃恢复的问题，我们只能补回来这个测试，针对不同版本的MySQL(MySQL 5.0.67 和MySQL5.1.xx)，需要进行相同TPS的场景下进行kill -9  pid (mysqld)的测试，掌握一手的崩溃恢复时间，为将来线上出现MySQL崩溃，做最好的准备 2. 我自己对MySQL InnoDB崩溃恢复的过程不是非常了解,导致MySQL崩溃之前没有去采集有参考价值的数值，这点需要加把劲 这一篇是前言，下一篇，我会对MySQL InnoDB的崩溃恢复过程做详细的介绍]]></description>
			<content:encoded><![CDATA[<p>最近一个正在进行的项目，性能测试场景中包含MySQL 为较大压力的应用程序提供服务，Linux服务器CPU占用100% ，OS 不可用，我写了一个吃CPU的shell脚本来不断的跑，结果把服务器跑挂了，手动重启了服务器后，发现MySQL起来的时间需要非常长，为大家所不能接受</p>
<p>MySQL相关信息   5.0.67    InnoDB Buffer Pool Size为36G  ,innodb_flush_log_at_trx_commit = 1，innodb_log_file_size = 900M</p>
<p>，当时候的服务器情况比较糟糕，CPU占用100% ，ssh也登录不进去，维持了一段时间后才进行重启，所以没有收集到最重要的崩溃之前的MySQL内部信息   整个的恢复过程用了6个小时</p>
<p><strong>这个时候，引发了我们的反思:</strong></p>
<p>1. 我们的MySQL压测模型没有针对不同版本的MySQL进行崩溃恢复压测  所以出现这个崩溃恢复的问题，我们只能补回来这个测试，针对不同版本的MySQL(MySQL 5.0.67 和MySQL5.1.xx)，需要进行相同TPS的场景下进行kill -9  pid (mysqld)的测试，掌握一手的崩溃恢复时间，为将来线上出现MySQL崩溃，做最好的准备</p>
<p>2. 我自己对MySQL InnoDB崩溃恢复的过程不是非常了解,导致MySQL崩溃之前没有去采集有参考价值的数值，这点需要加把劲</p>
<p>这一篇是前言，下一篇，我会对<strong>MySQL InnoDB的崩溃恢复过程</strong>做详细的介绍</p>
]]></content:encoded>
			<wfw:commentRss>http://dbahacker.com/mysql/mysql-innodb-%e5%b4%a9%e6%ba%83%e6%81%a2%e5%a4%8d%e8%bf%87%e7%a8%8b-%e5%89%8d%e8%a8%80/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>测试快速关闭innodb的方法</title>
		<link>http://dbahacker.com/mysql/innodb-fast-shutdown</link>
		<comments>http://dbahacker.com/mysql/innodb-fast-shutdown#comments</comments>
		<pubDate>Mon, 21 Jun 2010 07:31:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://dbahacker.com/?p=122</guid>
		<description><![CDATA[Google docs 查看地址 http://docs.google.com/Doc?docid=0AR0iV03BDag2ZGRyMjI5cjdfODAxZnd6ejZ2Z3c&#38;hl=en pdf下载地址 _mysqlporformanceblog_innodb_ (1) 测试mysqlporformanceblog提供的减少关闭innodb时间的方法 经常发现一些MySQL镜像库的InnoDB的关闭时间会特别久，mysqlperformanceblog给出了一个不错的解决方案 How to decrease InnoDB shutdown times http://www.mysqlperformanceblog.com/2009/04/15/how-to-decrease-innodb-shutdown-times/ InnoDB关闭的过程解释 MySQL官方手册介绍 影响到InnoDB关闭的参数有 innodb_fast_shutdown 如果你把这个参数设置为0，InnoDB在关闭之前做一个完全净化和一个插入缓冲合并。这些操作要花几分钟时间，在极端情况下要几个小时。 如果你设置这个参数为1，InnoDB在关闭之时跳过这些操作。 默认值为1。 如果你设置这个值为2 (在Netware无此值)， InnoDB将刷新它的日志然后冷关机，仿佛MySQL崩溃一样。已提交的事务不会被丢失，但在下一次启动之时会做一个崩溃恢复。 innodb_max_dirty_pages_pct 这是一个范围从0到100的整数。默认是90。InnoDB中的主线程试着从缓冲池写页面，使得脏页（没有被写的页面）的百分比不超过这个值。如果你有SUPER权限，这个百分比可以在服务器运行时按下面来改变： SET GLOBAL innodb_max_dirty_pages_pct = value; 100423  0:10:18  InnoDB: Starting shutdown&#8230; 100423  0:10:20  InnoDB: Shutdown completed; log sequence number 0 4000976145 100423  0:10:20 [Note] /usr/sbin/mysqld: Shutdown complete 测试环境 [...]]]></description>
			<content:encoded><![CDATA[<div style="font-family: Verdana; font-size: 10pt; background-color: #ffffff; color: #000000; min-height: 1100px; counter-reset: __goog_page__ 0; line-height: normal; padding: 0px; margin: 6px;">
<div style="margin-top: 0px; margin-bottom: 0px;"><strong>Google docs 查看地址</strong> <a href="http://docs.google.com/Doc?docid=0AR0iV03BDag2ZGRyMjI5cjdfODAxZnd6ejZ2Z3c&amp;hl=en" target="_blank">http://docs.google.com/Doc?docid=0AR0iV03BDag2ZGRyMjI5cjdfODAxZnd6ejZ2Z3c&amp;hl=en</a></div>
<div style="margin-top: 0px; margin-bottom: 0px;"></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><strong>pdf下载地址</strong> <a href="http://dbahacker.com/wp-content/uploads/2010/06/mysqlporformanceblog_innodb_-1.pdf">_mysqlporformanceblog_innodb_ (1)</a></div>
<div style="margin-top: 0px; margin-bottom: 0px;"></div>
<div style="margin-top: 0px; margin-bottom: 0px;">测试mysqlporformanceblog提供的减少关闭innodb时间的方法</div>
<div style="margin-top: 0px; margin-bottom: 0px;"></div>
<div style="margin-top: 0px; margin-bottom: 0px;">经常发现一些MySQL镜像库的InnoDB的关闭时间会特别久，mysqlperformanceblog给出了一个不错的解决方案</div>
<div style="margin-top: 0px; margin-bottom: 0px;"><strong>How to decrease InnoDB shutdown times </strong><a id="ggx8" style="color: #551a8b;" title="http://www.mysqlperformanceblog.com/2009/04/15/how-to-decrease-innodb-shutdown-times/" href="http://www.mysqlperformanceblog.com/2009/04/15/how-to-decrease-innodb-shutdown-times/">http://www.mysqlperformanceblog.com/2009/04/15/how-to-decrease-innodb-shutdown-times/</a></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="font-size: small;"><strong>InnoDB关闭的过程解释</strong></span></p>
<p>MySQL官方手册介绍 影响到InnoDB关闭的参数有</p>
<p style="background-color: transparent; background-image: initial; border-color: initial; border-style: initial; vertical-align: baseline; margin: 0px;"><span style="font-family: verdana, arial, helvetica, sans-serif;"><span style="color: #555555;"><span style="background-image: initial; border-color: initial; border-style: initial; margin-left: 0px; margin-right: 0px; vertical-align: baseline;"><span style="font-size: x-small;">innodb_fast_shutdown</span></span></span></span></p>
<p style="background-color: transparent; background-image: initial; border-color: initial; border-style: initial; vertical-align: baseline; margin: 0px;"><span style="font-family: verdana, arial, helvetica, sans-serif;"><span style="color: #555555;"><span style="background-image: initial; border-color: initial; border-style: initial; margin-left: 0px; margin-right: 0px; vertical-align: baseline;"><span style="font-size: x-small;">如果你把这个参数设置为0，InnoDB在关闭之前做一个完全净化和一个插入缓冲合并。这些操作要花几分钟时间，在极端情况下要几个小时。</span></span></span></span></p>
<p style="background-color: transparent; background-image: initial; border-color: initial; border-style: initial; vertical-align: baseline; margin: 0px;"><span style="font-family: verdana, arial, helvetica, sans-serif;"><span style="color: #555555;"><span style="background-image: initial; border-color: initial; border-style: initial; margin-left: 0px; margin-right: 0px; vertical-align: baseline;"><span style="font-size: x-small;">如果你设置这个参数为1，InnoDB在关闭之时跳过这些操作。 默认值为1。</span></span></span></span></p>
<p style="background-color: transparent; background-image: initial; border-color: initial; border-style: initial; vertical-align: baseline; margin: 0px;"><span style="font-family: verdana, arial, helvetica, sans-serif;"><span style="color: #555555;"><span style="background-image: initial; border-color: initial; border-style: initial; margin-left: 0px; margin-right: 0px; vertical-align: baseline;"><span style="font-size: x-small;">如果你设置这个值为2 (在Netware无此值)， InnoDB将刷新它的日志然后冷关机，仿佛MySQL崩溃一样。已提交的事务不会被丢失，但在下一次启动之时会做一个崩溃恢复。</span></span></span></span></p>
<p><span style="font-size: x-small;"><br />
</span></p>
<p style="background-color: transparent; background-image: initial; border-color: initial; border-style: initial; vertical-align: baseline; margin: 0px;"><span style="font-family: verdana, arial, helvetica, sans-serif;"><span style="color: #555555;"><span style="background-image: initial; border-color: initial; border-style: initial; margin-left: 0px; margin-right: 0px; vertical-align: baseline;"><span style="font-size: x-small;">innodb_max_dirty_pages_pct</span></span></span></span></p>
<p style="background-color: transparent; background-image: initial; border-color: initial; border-style: initial; vertical-align: baseline; margin: 0px;"><span style="font-family: verdana, arial, helvetica, sans-serif;"><span style="color: #555555;"><span style="background-image: initial; border-color: initial; border-style: initial; margin-left: 0px; margin-right: 0px; vertical-align: baseline;"><span style="font-size: x-small;">这是一个范围从0到100的整数。默认是90。InnoDB中的主线程试着从缓冲池写页面，使得脏页（没有被写的页面）的百分比不超过这个值。如果你有SUPER权限，这个百分比可以在服务器运行时按下面来改变：</span></span></span></span></p>
<p><span style="color: #555555;"><span style="font-family: 'Courier New';"><span style="background-image: initial; border-color: initial; border-style: initial; margin-left: 0px; margin-right: 0px; vertical-align: baseline;"><span style="font-size: x-small;">SET GLOBAL innodb_max_dirty_pages_pct = </span><em><span style="font-size: x-small;">value</span></em><span style="font-size: x-small;">;</span></span></span></span><br />
<span style="font-size: x-small;"><br />
</span><span style="font-size: x-small;"><br />
</span></p>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="font-size: x-small;">100423  0:10:18  InnoDB: Starting shutdown&#8230;</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="font-size: x-small;">100423  0:10:20  InnoDB: Shutdown completed; log sequence number 0 4000976145</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="font-size: x-small;">100423  0:10:20 [Note] /usr/sbin/mysqld: Shutdown complete</span></div>
<p><span style="font-size: x-small;"><br />
</span></p>
<h3 style="font-size: 12pt;">测试环境</h3>
<div style="margin-top: 0px; margin-bottom: 0px;">1.在一个镜像库节点进行测试,innodb_buffer_pool_size=1G</div>
<div style="margin-top: 0px; margin-bottom: 0px;">2.在一个线上节点进行测试,碰巧这个节点要进行机架更换,所以可以趁机测试一把</div>
<p>innodb_buffer_pool_size=12G,线上环境和镜像环境还是有点不一样,没法让<span style="color: #274e13;">Innodb_buffer_pool_pages_dirty的值少于1000，虽然是大于1000，但关闭起来还是比较快速的</span></p>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="font-size: small;"><strong>测试过程</strong></span><br />
<strong>正常关闭的normal-shutdown.sh</strong></p>
<div style="margin-top: 0px; margin-bottom: 0px;"><strong><br />
</strong></p>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="color: #38761d;">#!/bin/bash</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="color: #38761d;">#正常关闭innodb</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="color: #38761d;">log=”normal-shutdown.log”</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="color: #38761d;">start_time=`date`</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="color: #38761d;">echo “start time:”$start_time &gt; $log</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="color: #38761d;">mysqladmin &#8211;defaults-file=db-32-1.cnf -uxxx -pxxx  ext  | grep dirty &gt;&gt; $log</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="color: #38761d;">mysqladmin &#8211;defaults-file=db-32-1.cnf -uxxx -pxxx shutdown</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="color: #38761d;">end_time=`date`</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="color: #38761d;">echo “end time:” $end_time &gt;&gt; $log</span></div>
<p>normal-shutdown.log 输出的日志如下</p></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="color: #274e13;">start time:2010年 06月 18日 星期五 17:21:00 CST</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="color: #274e13;">| Innodb_buffer_pool_pages_dirty    | 43492        |</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="color: #274e13;">end time: 2010年 06月 18日 星期五 17:23:10 CST</span></div>
<p><strong>设置</strong><span style="font-family: 'courier new';"><span style="color: #38761d;"><strong>set global innodb_max_dirty_pages_pct =0的<span><span style="background-color: #ffffff;"><span style="color: #000000;">关闭方式</span></span></span></strong></span></span></p>
<div style="margin-top: 0px; margin-bottom: 0px;">首先执行 <span style="color: #38761d;">mysql &#8211;defaults-file=db-31-2.cnf -uxxx -pxxx -e” <span style="font-family: 'courier new';">set global innodb_max_dirty_pages_pct =0</span>“</span><br />
经过了大概3分钟后 Innodb_buffer_pool_pages_dirty的值少于1000</div>
<div style="margin-top: 0px; margin-bottom: 0px;">然后执行faster-shutdown.sh，生成faster-shutdown.log</div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="color: #38761d;">#!/bin/bash</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="color: #38761d;">log=”faster-shutdown.log”</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="color: #38761d;">start_time=`date`</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="color: #38761d;">echo “faster shutdown start time:”$start_time &gt;$log</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="color: #38761d;">mysqladmin &#8211;defaults-file=db-32-1.cnf -uxxx -pxxx  ext  | grep dirty &gt;&gt; $log</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="color: #38761d;">mysqladmin &#8211;defaults-file=db-32-1.cnf -uxxx -pxxx shutdown</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="color: #38761d;">end_time=`date`</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="color: #38761d;">echo “faster shutdown end time:” $end_time &gt;&gt;$log</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;">faster-shutdown.log的内容</div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="color: #38761d;">faster shutdown start time:2010年 06月 18日 星期五 17:47:08 CST</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="color: #38761d;">| Innodb_buffer_pool_pages_dirty    | 569        |</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="color: #38761d;">faster shutdown end time: 2010年 06月 18日 星期五 17:47:12 CST</span></div>
<p><span style="font-size: small;"><strong>关闭时间比较</strong></span></p>
<table id="e605" style="font-size: 1em; line-height: inherit; border-collapse: collapse;" border="1" cellspacing="0" cellpadding="3" bordercolor="#000000">
<tbody>
<tr style="text-align: left;">
<td width="33.333333333333336%"></td>
<td width="33.333333333333336%">正常关闭</td>
<td width="33.333333333333336%">快速关闭</td>
</tr>
<tr style="text-align: left;">
<td width="33.333333333333336%">Innodb_buffer_pool_pages_dirty</td>
<td width="33.333333333333336%">43492</td>
<td width="33.333333333333336%">569</td>
</tr>
<tr style="text-align: left;">
<td width="33.333333333333336%">关闭时间</td>
<td width="33.333333333333336%">2分10秒</td>
<td width="33.333333333333336%">4秒</td>
</tr>
</tbody>
</table>
<h3 style="font-size: 12pt;">结论</h3>
<div style="margin-top: 0px; margin-bottom: 0px;">日常维护中,可以使用<span style="font-family: 'courier new';"><span style="color: #38761d;">set global innodb_max_dirty_pages_pct =0,</span>让<span style="color: #38761d;">Innodb_buffer_pool_pages_dirty </span>的数值为一个较小的值,这样就可以减少在关闭mysql服务器中耗费在innodb的时间</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><span style="font-family: 'courier new';">最终达到减少影响用户的时间</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;">参考资料</div>
<p><strong>InnoDB启动 </strong><a style="color: #551a8b;" href="http://dev.mysql.com/doc/refman/5.1/zh/storage-engines.html#innodb-start"><strong>http://dev.mysql.com/doc/refman/5.1/zh/storage-engines.html#innodb-start</strong></a><br />
<strong><br />
</strong></p>
<div style="margin-top: 0px; margin-bottom: 0px;"><strong>How to decrease InnoDB shutdown times </strong><a id="kp-." style="color: #551a8b;" title="http://www.mysqlperformanceblog.com/2009/04/15/how-to-decrease-innodb-shutdown-times/" href="http://www.mysqlperformanceblog.com/2009/04/15/how-to-decrease-innodb-shutdown-times/">http://www.mysqlperformanceblog.com/2009/04/15/how-to-decrease-innodb-shutdown-times/</a></div>
<p><strong>Dirty pages, fast shutdown, and write combining </strong><a style="color: #551a8b;" href="http://www.xaprb.com/blog/2010/05/25/dirty-pages-fast-shutdown-and-write-combining/">http://www.xaprb.com/blog/2010/05/25/dirty-pages-fast-shutdown-and-write-combining/</a></div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://dbahacker.com/mysql/innodb-fast-shutdown/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MySQL5.1 InnoDB Plugin 启动信息详解 以及与MySQL5.0的InnoDB启动信息对比</title>
		<link>http://dbahacker.com/mysql/innodb-plugin-log-analyze</link>
		<comments>http://dbahacker.com/mysql/innodb-plugin-log-analyze#comments</comments>
		<pubDate>Wed, 09 Jun 2010 12:48:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://dbahacker.com/?p=115</guid>
		<description><![CDATA[经过一段时间的测试,准备把MySQL 5.1 InnoDB Plugin部署到线上，今天发现MySQL 5.0 InnoDB 和MySQL5.1 InnoDB Plugin启动是有点区别的，这里做一个整理 5.0MySQL 的版本信息 mysql&#62; show variables like &#8217;%version%&#8217;; +&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+ &#124; Variable_name           &#124; Value                       &#124; +&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+ &#124; protocol_version        &#124; 10                          &#124; &#124; version                 &#124; 5.0.38-Debian_3netease5-log &#124; &#124; version_comment         &#124; Debian etch distribution    &#124; &#124; version_compile_machine &#124; x86_64                      &#124; &#124; version_compile_os      &#124; pc-linux-gnu                &#124; +&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+ 5 rows in set (0.01 sec) 启动的日志信息 InnoDB: The first specified data file xxx//ibdata1 did not exist: InnoDB: a new database to be created! 100609 19:18:50  InnoDB: Setting file xxx//ibdata1 size to 32 MB InnoDB: Database physically writes the file full: wait&#8230; 100609 19:18:51  InnoDB: Log file xxx/ib_logfile0 did not exist: new to be created InnoDB: Setting log file xxx/ib_logfile0 size to 128 MB InnoDB: Database physically writes the file full: wait&#8230; InnoDB: Progress in MB: 100 100609 19:18:53  InnoDB: Log file xxx/ib_logfile1 did not exist: new to be created InnoDB: Setting log file xxxx/ib_logfile1 size to 128 MB InnoDB: Database physically writes the file full: wait&#8230; InnoDB: Progress in MB: 100 InnoDB: Doublewrite buffer not found: creating new InnoDB: Doublewrite buffer created InnoDB: Creating foreign key constraint system tables InnoDB: Foreign key constraint system tables created 100609 19:18:57  InnoDB: Started; log sequence number 0 0 100609 19:18:57 [Note] /usr/sbin/mysqld: ready for connections. Version: &#8217;5.0.38-Debian_3netease5-log&#8217;  socket: xxx/mysqld.sock&#8217;  port: 4591  Debian etch distribution MySQL 5.1 的版本信息 mysql&#62;  show variables like &#8217;%version%&#8217;; +&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+ &#124; Variable_name           &#124; Value               &#124; +&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+ &#124; innodb_version          &#124; 1.0.6-unknown       &#124; ##这个是InnoDB Plugin的新信息 &#124; protocol_version        &#124; 10                  &#124; &#124; version                 &#124; 5.1.45-log          &#124; &#124; version_comment         &#124; Source distribution &#124; &#124; version_compile_machine &#124; x86_64              &#124; &#124; version_compile_os      &#124; unknown-linux-gnu   &#124; +&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+ MySQL5.1 InnoDB Plugin启动日志信息，多了很多内容，下面逐一介绍 InnoDB: The InnoDB memory heap is disabled InnoDB: Mutexes and rw_locks use GCC atomic builtins InnoDB: The first specified data file ./ibdata1 did not exist: InnoDB: a new database to be created! 100609 17:17:11  InnoDB: Setting file ./ibdata1 size to 512 MB InnoDB: Database physically writes the file full: wait&#8230; InnoDB: Progress in MB: 100 200 300 400 500 100609 17:17:15  InnoDB: Log file xxx/ib_logfile0 did not exist: new to be created InnoDB: Setting log file [...]]]></description>
			<content:encoded><![CDATA[<p>经过一段时间的测试,准备把MySQL 5.1 InnoDB Plugin部署到线上，今天发现MySQL 5.0 InnoDB 和MySQL5.1 InnoDB Plugin启动是有点区别的，这里做一个整理</p>
<p>5.0MySQL 的版本信息</p>
<blockquote><p>mysql&gt; show variables like &#8217;%version%&#8217;;</p>
<p>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+</p>
<p>| Variable_name           | Value                       |</p>
<p>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+</p>
<p>| protocol_version        | 10                          |</p>
<p>| version                 | 5.0.38-Debian_3netease5-log |</p>
<p>| version_comment         | Debian etch distribution    |</p>
<p>| version_compile_machine | x86_64                      |</p>
<p>| version_compile_os      | pc-linux-gnu                |</p>
<p>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+</p>
<p>5 rows in set (0.01 sec)</p></blockquote>
<p>启动的日志信息</p>
<blockquote><p>InnoDB: The first specified data file xxx//ibdata1 did not exist:</p>
<p>InnoDB: a new database to be created!</p>
<p>100609 19:18:50  InnoDB: Setting file xxx//ibdata1 size to 32 MB</p>
<p>InnoDB: Database physically writes the file full: wait&#8230;</p>
<p>100609 19:18:51  InnoDB: Log file xxx/ib_logfile0 did not exist: new to be created</p>
<p>InnoDB: Setting log file xxx/ib_logfile0 size to 128 MB</p>
<p>InnoDB: Database physically writes the file full: wait&#8230;</p>
<p>InnoDB: Progress in MB: 100</p>
<p>100609 19:18:53  InnoDB: Log file xxx/ib_logfile1 did not exist: new to be created</p>
<p>InnoDB: Setting log file xxxx/ib_logfile1 size to 128 MB</p>
<p>InnoDB: Database physically writes the file full: wait&#8230;</p>
<p>InnoDB: Progress in MB: 100</p>
<p>InnoDB: Doublewrite buffer not found: creating new</p>
<p>InnoDB: Doublewrite buffer created</p>
<p>InnoDB: Creating foreign key constraint system tables</p>
<p>InnoDB: Foreign key constraint system tables created</p>
<p>100609 19:18:57  InnoDB: Started; log sequence number 0 0</p>
<p>100609 19:18:57 [Note] /usr/sbin/mysqld: ready for connections.</p>
<p>Version: &#8217;5.0.38-Debian_3netease5-log&#8217;  socket: xxx/mysqld.sock&#8217;  port: 4591  Debian etch distribution</p></blockquote>
<p>MySQL 5.1 的版本信息</p>
<blockquote><p>mysql&gt;  show variables like &#8217;%version%&#8217;;</p>
<p>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+</p>
<p>| Variable_name           | Value               |</p>
<p>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+</p>
<p>| innodb_version          | 1.0.6-unknown       | ##这个是InnoDB Plugin的新信息</p>
<p>| protocol_version        | 10                  |</p>
<p>| version                 | 5.1.45-log          |</p>
<p>| version_comment         | Source distribution |</p>
<p>| version_compile_machine | x86_64              |</p>
<p>| version_compile_os      | unknown-linux-gnu   |</p>
<p>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+</p></blockquote>
<p>MySQL5.1 InnoDB Plugin启动日志信息，多了很多内容，下面逐一介绍</p>
<blockquote><p>InnoDB: The InnoDB memory heap is disabled</p>
<p>InnoDB: Mutexes and rw_locks use GCC atomic builtins</p>
<p>InnoDB: The first specified data file ./ibdata1 did not exist:</p>
<p>InnoDB: a new database to be created!</p>
<p>100609 17:17:11  InnoDB: Setting file ./ibdata1 size to 512 MB</p>
<p>InnoDB: Database physically writes the file full: wait&#8230;</p>
<p>InnoDB: Progress in MB: 100 200 300 400 500</p>
<p>100609 17:17:15  InnoDB: Log file xxx/ib_logfile0 did not exist: new to be created</p>
<p>InnoDB: Setting log file  xxx/ib_logfile0 size to 512 MB</p>
<p>InnoDB: Database physically writes the file full: wait&#8230;</p>
<p>InnoDB: Progress in MB: 100 200 300 400 500</p>
<p>100609 17:17:21  InnoDB: Log file xxx/ib_logfile1 did not exist: new to be created</p>
<p>InnoDB: Setting log file xxxx/ib_logfile1 size to 512 MB</p>
<p>InnoDB: Database physically writes the file full: wait&#8230;</p>
<p>InnoDB: Progress in MB: 100 200 300 400 500</p>
<p>InnoDB: Doublewrite buffer not found: creating new</p>
<p>InnoDB: Doublewrite buffer created</p>
<p>InnoDB: Creating foreign key constraint system tables</p>
<p>InnoDB: Foreign key constraint system tables created</p>
<p>100609 17:17:26 InnoDB Plugin 1.0.6-unknown started; log sequence number 0</p>
<p>100609 17:17:28 [Note] Event Scheduler: Loaded 0 events</p>
<p>100609 17:17:28 [Note] /usr/xtradb/libexec/mysqld: ready for connections.</p>
<p>Version: &#8217;5.1.45-log&#8217;  socket: &#8217;xxx/mysqld.sock&#8217;  port: 4331  Source distribution</p></blockquote>
<p>InnoDB: The InnoDB memory heap is disabled</p>
<p>是因为使用了操作系统的内存分配器,所以就禁用了InnoDB的内置内存分配器</p>
<blockquote><p>mysql&gt; show variables like &#8217;%malloc%&#8217;;</p>
<p>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+</p>
<p>| Variable_name         | Value |</p>
<p>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+</p>
<p>| innodb_use_sys_malloc | ON    |</p>
<p>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;-+</p>
<p>1 row in set (0.00 sec)</p></blockquote>
<p>而在5.0里面执行是为空结果的，关于这个innodb_use_sys_malloc，具体可以参阅<a href="http://www.innodb.com/doc/innodb_plugin-1.0-doc-single/innodb-plugin.html#innodb-performance-use_sys_malloc">InooDB的官方介绍</a></p>
<p>Mutexes and rw_locks use GCC atomic builtins</p>
<p>对比以往的版本,InnoDB Plugin 1.0.3之后的版本 使用了GCC atomic builtins来执行互斥和读写锁,性能会比以往使用的pthread_mutex_t要高效</p>
<p>参见 <a href="http://www.innodb.com/wp/support/tips/atomics/">InnoDB Plugin: Enabling GCC atomic built-in functions for InnoDB rw-locks</a><br />
InnoDB: The first specified data file ./ibdata1 did not exist:</p>
<p>InnoDB: a new database to be created!</p>
<p>第一次启动mysql，因为默认的是innodb引擎，所以会自动创建一个test</p>
<blockquote><p>InnoDB: Doublewrite buffer not found: creating new</p>
<p>InnoDB: Doublewrite buffer created</p></blockquote>
<p>什么是Doublewrite?</p>
<p>InnoDB将BP中的Dirty Page刷（flush）到磁盘上时，首先会将Page刷到InnoDB tablespace的一个区域中，我们称该区域为Double write Buffer。在向Double write Buffer写入成功后，再择机将数据拷贝到正在的数据文件对应的位置。</p>
<p>更多详细的信息可以看看performace blog 的对<a href="http://www.mysqlperformanceblog.com/2006/08/04/innodb-double-write/#more-72">doublewrite的介绍</a></p>
<p>或者是苏普的对<a href="http://www.orczhou.com/index.php/2010/02/innodb-double-write/">Doublewrite整理 InnoDB Double write</a></p>
<p>参考资料</p>
<p>InnoDB Plugin: Enabling GCC atomic built-in functions for InnoDB rw-locks</p>
<p><a href="http://www.innodb.com/wp/support/tips/atomics/">http://www.innodb.com/wp/support/tips/atomics/</a></p>
<p>InnoDB Plugin 1.0 for MySQL 5.1 User’s Guide</p>
<p><a href="http://www.innodb.com/doc/innodb_plugin-1.0-doc-single/innodb-plugin.html#innodb-performance-use_sys_malloc">http://www.innodb.com/doc/innodb_plugin-1.0-doc-single/innodb-plugin.html#innodb-performance-use_sys_malloc</a></p>
<p>Innodb Double Write</p>
<p><a href="http://www.mysqlperformanceblog.com/2006/08/04/innodb-double-write/#more-72">http://www.mysqlperformanceblog.com/2006/08/04/innodb-double-write/#more-72</a></p>
<p>转载烦请保留原文连接 http://dbahacker.com/mysql/<span id="editable-post-name" style="outline-width: 0px; outline-style: initial; outline-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #fffbcc; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;" title="点击编辑这部分固定链接">innodb-plugin-log-analyze</span></p>
]]></content:encoded>
			<wfw:commentRss>http://dbahacker.com/mysql/innodb-plugin-log-analyze/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Master-Slave的一个read log event 错误处理</title>
		<link>http://dbahacker.com/mysql/master-slave-read-log-event</link>
		<comments>http://dbahacker.com/mysql/master-slave-read-log-event#comments</comments>
		<pubDate>Tue, 08 Jun 2010 06:10:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://dbahacker.com/?p=111</guid>
		<description><![CDATA[Master-Slave的一个read log event 错误处理 现在简单介绍一下几个节点的情况 B服务器上面有一个B1节点，是MySQL5.0版本，普通InnoDB的表 C服务器上面有两个测试节点（C1，C2）, 它们是A服务器上面的A1节点的slave,C1，C2，都是使用XtraDB压缩功能的表 也就是 A为Master,有3个Slave(B1,C1,C2) 因为某些原因,C2的slave 复制出现了问题,而C1是没有问题的，当时候采取了以下措施 1.停止C1,C2的slave,使用mysqladmin shutdown来关闭C1,C2 2.删掉C2的数据目录等，只留下my.cnf 3.把C1的数据目录等都拷贝到C2目录下 4.启动C1,C2 这时候发现C2的mysqd.log 里面有了这样的内容 100608 12:44:14 [Note] Slave: received end packet from server, apparent master shutdown: 100608 12:44:14 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log &#8216;mysql-bin.007817&#8242; at postion 86542498 100608 12:44:15 [Note] Slave I/O thread [...]]]></description>
			<content:encoded><![CDATA[<p>Master-Slave的一个read log event 错误处理</p>
<p>现在简单介绍一下几个节点的情况<br />
B服务器上面有一个B1节点，是MySQL5.0版本，普通InnoDB的表<br />
C服务器上面有两个测试节点（C1，C2）,<br />
它们是A服务器上面的A1节点的slave,C1，C2，都是使用XtraDB压缩功能的表</p>
<p>也就是 A为Master,有3个Slave(B1,C1,C2)</p>
<p>因为某些原因,C2的slave 复制出现了问题,而C1是没有问题的，当时候采取了以下措施<br />
1.停止C1,C2的slave,使用mysqladmin shutdown来关闭C1,C2<br />
2.删掉C2的数据目录等，只留下my.cnf<br />
3.把C1的数据目录等都拷贝到C2目录下<br />
4.启动C1,C2</p>
<p>这时候发现C2的mysqd.log 里面有了这样的内容</p>
<blockquote><p>100608 12:44:14 [Note] Slave: received end packet from server, apparent master shutdown:<br />
100608 12:44:14 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log &#8216;mysql-bin.007817&#8242; at postion 86542498<br />
100608 12:44:15 [Note] Slave I/O thread killed while reading event</p></blockquote>
<p>同时在C2里面执行show slave status \G的时候,Seconds_behind_master = 会出现落后的秒数，但连续的执行show slave status 的时候就会看到有NULL的信息</p>
<p>mysqlperformanceblog有一篇文章是提到过是server-id的问题 http://www.mysqlperformanceblog.com/2008/06/04/confusing-mysql-replication-error-message/<br />
但是我的3个slave的server-id都是不一样的，和master的server-id也是不一样的</p>
<p>最后的解决方法是尝试了一把把C2的server-id改成新的值，重启mysql,stop slave ;start slave;show slave status \G后发现复制正常了，不知道是否和我直接copy C1的数据库等文件过来是否有关</p>
<p>参考文献/文章</p>
<p><a href="http://www.mysqlperformanceblog.com/2008/06/04/confusing-mysql-replication-error-message/"> Confusing MySQL Replication Error Message</a> http://www.mysqlperformanceblog.com/2008/06/04/confusing-mysql-replication-error-message/<br />
<a href="http://bugs.mysql.com/bug.php?id=9325"> Many Errors “Slave: received end packet from server” </a> http://bugs.mysql.com/bug.php?id=9325</p>
]]></content:encoded>
			<wfw:commentRss>http://dbahacker.com/mysql/master-slave-read-log-event/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[存储引擎基础知识]InnoDB与MyISAM的六大区别</title>
		<link>http://dbahacker.com/mysql/innodb-myisam-compare</link>
		<comments>http://dbahacker.com/mysql/innodb-myisam-compare#comments</comments>
		<pubDate>Mon, 07 Jun 2010 14:03:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://dbahacker.com/?p=106</guid>
		<description><![CDATA[这其实是09年总结的一篇文章，今天被一位朋友问到InnoDB有什么好处，一下子讲不清楚，现在把在自己另外一个博客的文章在这里重发一遍，主要是讲InnoDB和MyISAM的对比，从中可以看到InnoDB的很多好处，比如并发插入的时候行级锁等 本 文主要整理了Mysql 两大常用的存储引擎MyISAM，InnoDB的六大常见区别，来源于Mysql手册以及互联网的资料 InnoDB与Myisam的六大区别 MyISAM InnoDB 构 成上的区别： 每个MyISAM在磁盘上存储成三个文件。第一个 文件的名字以表的名字开始，扩展名指出文件类型。 .frm文件存储表定义。 数据文件的扩 展名为.MYD (MYData)。 索引文件的扩 展名是.MYI (MYIndex)。 基于磁盘的资源是InnoDB表空间数据文件和它的日志文件，InnoDB 表的 大小只受限于操作系统文件的大小，一般为 2GB 事务处理上方面: MyISAM类型的表强调的是性能，其执行数 度比InnoDB类型更快，但是不提供事务支持 InnoDB提供事务支持事务，外部键等高级 数据库功能 SELECT UPDATE,INSERT，Delete操 作 如果执行大量的SELECT，MyISAM是更好的选择 1.如果你的数据执行大量的INSERT或UPDATE，出于性能方面的考虑，应该使用InnoDB表 2.DELETE FROM table时，InnoDB不会重新建立表，而是一行一行的 删除。 3.LOAD TABLE FROM MASTER操作对InnoDB是不起作用的，解决方法是首先把InnoDB表改成MyISAM表，导入数据后再改成InnoDB表，但是对于使用的额外的InnoDB特性（例如外键）的表不适用 对AUTO_INCREMENT的 操作 每表一个AUTO_INCREMEN列的内部处理。 MyISAM为INSERT和UPDATE操 作自动更新这一列。这使得AUTO_INCREMENT列更快（至少10%）。在序列顶的值被删除之后就不 能再利用。(当AUTO_INCREMENT列被定义为多列索引的最后一列， 可以出现重使用从序列顶部删除的值的情况）。 AUTO_INCREMENT值可用ALTER TABLE或myisamch来重置 对于AUTO_INCREMENT类型的字段，InnoDB中必须包含只有该字段的索引，但 是在MyISAM表中，可以和其他字段一起建立联 合索引 更好和更快的auto_increment处理 如果你为一个表指定AUTO_INCREMENT列，在数据词典里的InnoDB表句柄包含一个名为自动增长计数 器的计数器，它被用在为该列赋新值。 [...]]]></description>
			<content:encoded><![CDATA[<p>这其实是09年总结的一篇文章，今天被一位朋友问到<strong>InnoDB有什么好处</strong>，一下子讲不清楚，现在把在自己<a href="http://2005yangdehua.blog.163.com/blog/static/4864643620096189240600/" target="_blank">另外一个博客的文章</a>在这里重发一遍，主要是讲InnoDB和MyISAM的对比，从中可以看到InnoDB的很多好处，比如并发插入的时候行级锁等</p>
<p style="text-indent: 21pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">本 文主要整理了Mysql 两大常用的存储引擎MyISAM，InnoDB的六大常见区别，来源于Mysql手册以及互联网的资料<br />
</span></p>
<p style="text-indent: 21pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><br />
</span></p>
<table style="border: medium none; border-collapse: collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="border: 1pt solid black; padding: 0cm 5.4pt; width: 426.1pt;" colspan="3" width="568" valign="top">
<p style="margin-left: 18pt; text-align: center;" align="center"><strong><span style="font-size: 9pt;" lang="EN-US">InnoDB</span></strong><strong><span style="font-size: 9pt; font-family: 宋体;">与</span></strong><strong><span style="font-size: 9pt;" lang="EN-US">Myisam</span></strong><strong><span style="font-size: 9pt; font-family: 宋体;">的六大区别</span></strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"> </span></p>
</td>
</tr>
<tr>
<td style="padding: 0cm 5.4pt; width: 90.45pt; border: medium 1pt 1pt none solid solid -moz-use-text-color  black black;" width="121" valign="top"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"> </span></td>
<td style="padding: 0cm  5.4pt; width: 204.65pt; border: medium 1pt 1pt medium none solid  solid none -moz-use-text-color black black  -moz-use-text-color;" width="273" valign="top"><strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">MyISAM</span></strong></td>
<td style="padding: 0cm 5.4pt; width: 131pt; border: medium 1pt 1pt medium none solid solid none -moz-use-text-color black black -moz-use-text-color;" width="175" valign="top"><strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">InnoDB</span></strong></td>
</tr>
<tr>
<td style="padding: 0cm 5.4pt; width: 90.45pt; border: medium 1pt  1pt none solid solid -moz-use-text-color black black;" width="121" valign="top"><strong><span style="font-size: 10pt; font-family: 宋体; color: black;">构 成上的区别：</span></strong></td>
<td style="padding: 0cm 5.4pt; width: 204.65pt; border: medium 1pt 1pt medium none solid solid none -moz-use-text-color black black -moz-use-text-color;" width="273" valign="top"><span style="font-size: 10pt; font-family: 宋体; color: black;">每个</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">MyISAM</span><span style="font-size: 10pt; font-family: 宋体; color: black;">在磁盘上存储成三个文件。第一个 文件的名字以表的名字开始，扩展名指出文件类型。</span></p>
<p><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">.frm</span><span style="font-size: 10pt; font-family: 宋体; color: black;">文件存储表定义。</span></p>
<p><span style="font-size: 10pt; font-family: 宋体; color: black;">数据文件的扩 展名为</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">.MYD  (MYData)</span><span style="font-size: 10pt; font-family: 宋体; color: black;">。</span></p>
<p><span style="font-size: 10pt; font-family: 宋体; color: black;">索引文件的扩 展名是</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">.MYI  (MYIndex)</span><span style="font-size: 10pt; font-family: 宋体; color: black;">。</span></td>
<td style="padding: 0cm 5.4pt; width: 131pt; border: medium 1pt 1pt medium none solid solid none -moz-use-text-color black black -moz-use-text-color;" width="175" valign="top"><span style="font-size: 10pt; font-family: 宋体; color: black;">基于磁盘的资源是</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">InnoDB</span><span style="font-size: 10pt; font-family: 宋体; color: black;">表空间数据文件和它的日志文件，</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">InnoDB </span><span style="font-size: 10pt; font-family: 宋体; color: black;">表的 大小只受限于操作系统文件的大小，一般为</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"> 2GB</span></td>
</tr>
<tr>
<td style="padding: 0cm 5.4pt; width: 90.45pt; border: medium 1pt 1pt none  solid solid -moz-use-text-color black black;" width="121" valign="top"><strong><span style="font-size: 10pt; font-family: 宋体; color: black;">事务处理上方面</span></strong><strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">:</span></strong></td>
<td style="padding: 0cm 5.4pt; width: 204.65pt; border: medium 1pt 1pt medium none solid solid none -moz-use-text-color black black -moz-use-text-color;" width="273" valign="top"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">MyISAM</span><span style="font-size: 10pt; font-family: 宋体; color: black;">类型的表强调的是性能，其执行数 度比</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">InnoDB</span><span style="font-size: 10pt; font-family: 宋体; color: black;">类型更快，但是不提供事务支持</span></td>
<td style="padding: 0cm 5.4pt; width: 131pt; border: medium 1pt 1pt medium none solid solid none -moz-use-text-color black black -moz-use-text-color;" width="175" valign="top"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">InnoDB</span><span style="font-size: 10pt; font-family: 宋体; color: black;">提供事务支持事务，外部键等高级 数据库功能</span></td>
</tr>
<tr>
<td style="padding: 0cm 5.4pt; width: 90.45pt; border: medium 1pt  1pt none solid solid -moz-use-text-color black black;" width="121" valign="top"><strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">SELECT  UPDATE,INSERT</span></strong><strong><span style="font-size: 10pt; font-family: 宋体; color: black;">，</span></strong><strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">Delete</span></strong><strong><span style="font-size: 10pt; font-family: 宋体; color: black;">操 作</span></strong><strong> </strong></td>
<td style="padding: 0cm 5.4pt; width: 204.65pt; border: medium 1pt 1pt medium none solid solid none -moz-use-text-color black black -moz-use-text-color;" width="273" valign="top"><span style="font-size: 10pt; font-family: 宋体; color: black;">如果执行大量的</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">SELECT</span><span style="font-size: 10pt; font-family: 宋体; color: black;">，</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">MyISAM</span><span style="font-size: 10pt; font-family: 宋体; color: black;">是更好的选择</span></td>
<td style="padding: 0cm 5.4pt; width: 131pt; border: medium 1pt 1pt medium none solid solid none -moz-use-text-color black black -moz-use-text-color;" width="175" valign="top"><strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">1.</span></strong><span style="font-size: 10pt; font-family: 宋体; color: black;">如果你的数据执行大量的</span><strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">INSERT</span></strong><strong><span style="font-size: 10pt; font-family: 宋体; color: black;">或</span></strong><strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">UPDATE</span></strong><span style="font-size: 10pt; font-family: 宋体; color: black;">，出于性能方面的考虑，应该使用</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">InnoDB</span><span style="font-size: 10pt; font-family: 宋体; color: black;">表</span></p>
<p><strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">2.DELETE  FROM table</span></strong><span style="font-size: 10pt; font-family: 宋体; color: black;">时，</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">InnoDB</span><span style="font-size: 10pt; font-family: 宋体; color: black;">不会重新建立表，而是一行一行的 删除。</span></p>
<p><strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">3.LOAD  TABLE FROM MASTER</span></strong><span style="font-size: 10pt; font-family: 宋体; color: black;">操作对</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">InnoDB</span><span style="font-size: 10pt; font-family: 宋体; color: black;">是不起作用的，解决方法是首先把</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">InnoDB</span><span style="font-size: 10pt; font-family: 宋体; color: black;">表改成</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">MyISAM</span><span style="font-size: 10pt; font-family: 宋体; color: black;">表，导入数据后再改成</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">InnoDB</span><span style="font-size: 10pt; font-family: 宋体; color: black;">表，但是对于使用的额外的</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">InnoDB</span><span style="font-size: 10pt; font-family: 宋体; color: black;">特性（例如外键）的表不适用</span></td>
</tr>
<tr>
<td style="padding: 0cm 5.4pt; width: 90.45pt; border: medium 1pt  1pt none solid solid -moz-use-text-color black black;" width="121" valign="top"><strong><span style="font-size: 10pt; font-family: 宋体; color: black;">对</span></strong><strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">AUTO_INCREMENT</span></strong><strong><span style="font-size: 10pt; font-family: 宋体; color: black;">的 操作</span></strong></p>
<p><strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"> </span></strong></td>
<td style="padding: 0cm 5.4pt; width: 204.65pt; border: medium 1pt 1pt medium none solid solid none -moz-use-text-color black black -moz-use-text-color;" width="273" valign="top"><span style="font-size: 10pt; font-family: 宋体; color: black;">每表一个</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">AUTO_INCREMEN</span><span style="font-size: 10pt; font-family: 宋体; color: black;">列的内部处理。</span></p>
<p><strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">MyISAM</span></strong><strong><span style="font-size: 10pt; font-family: 宋体; color: black;">为</span></strong><strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">INSERT</span></strong><strong><span style="font-size: 10pt; font-family: 宋体; color: black;">和</span></strong><strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">UPDATE</span></strong><strong><span style="font-size: 10pt; font-family: 宋体; color: black;">操 作自动更新这一列</span></strong><span style="font-size: 10pt; font-family: 宋体; color: black;">。这使得</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">AUTO_INCREMENT</span><span style="font-size: 10pt; font-family: 宋体; color: black;">列更快（至少</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">10%</span><span style="font-size: 10pt; font-family: 宋体; color: black;">）。在序列顶的值被删除之后就不 能再利用。</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">(</span><span style="font-size: 10pt; font-family: 宋体; color: black;">当</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">AUTO_INCREMENT</span><span style="font-size: 10pt; font-family: 宋体; color: black;">列被定义为多列索引的最后一列， 可以出现重使用从序列顶部删除的值的情况）。</span></p>
<p><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">AUTO_INCREMENT</span><span style="font-size: 10pt; font-family: 宋体; color: black;">值可用</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">ALTER  TABLE</span><span style="font-size: 10pt; font-family: 宋体; color: black;">或</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">myisamch</span><span style="font-size: 10pt; font-family: 宋体; color: black;">来重置</span></p>
<p><span style="font-size: 10pt; font-family: 宋体; color: black;">对于</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">AUTO_INCREMENT</span><span style="font-size: 10pt; font-family: 宋体; color: black;">类型的字段，</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">InnoDB</span><span style="font-size: 10pt; font-family: 宋体; color: black;">中必须包含只有该字段的索引，但 是在</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">MyISAM</span><span style="font-size: 10pt; font-family: 宋体; color: black;">表中，可以和其他字段一起建立联 合索引</span></p>
<p><span style="font-family: 宋体;">更好和更快的</span><span lang="EN-US">auto_increment</span><span style="font-family: 宋体;">处理</span></td>
<td style="padding: 0cm  5.4pt; width: 131pt; border: medium 1pt 1pt medium none solid solid  none -moz-use-text-color black black  -moz-use-text-color;" width="175" valign="top"><span style="font-size: 10pt; font-family: 宋体; color: black;">如果你为一个表指定</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">AUTO_INCREMENT</span><span style="font-size: 10pt; font-family: 宋体; color: black;">列，在数据词典里的</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">InnoDB</span><span style="font-size: 10pt; font-family: 宋体; color: black;">表句柄包含一个名为自动增长计数 器的计数器，它被用在为该列赋新值。</span></p>
<p><span style="font-size: 10pt; font-family: 宋体; color: black;">自动增长计数 器仅被存储在主内存中，而不是存在磁盘上</span></p>
<p><span style="font-size: 10pt; font-family: 宋体; color: black;">关于该计算器 的算法实现，请参考</span></p>
<p><strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">AUTO_INCREMENT</span></strong><strong><span style="font-size: 10pt; font-family: 宋体; color: black;">列 在</span></strong><strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">InnoDB</span></strong><strong><span style="font-size: 10pt; font-family: 宋体; color: black;">里 如何工作</span></strong></td>
</tr>
<tr>
<td style="padding: 0cm 5.4pt; width: 90.45pt; border: medium 1pt  1pt none solid solid -moz-use-text-color black black;" width="121" valign="top"><strong><span style="font-size: 10pt; font-family: 宋体; color: black;">表 的具体行数</span></strong><strong> </strong></td>
<td style="padding: 0cm 5.4pt; width: 204.65pt; border: medium 1pt 1pt medium none solid solid none -moz-use-text-color black black -moz-use-text-color;" width="273" valign="top"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">select  count(*) from table,MyISAM</span><span style="font-size: 10pt; font-family: 宋体; color: black;">只要简单的读出保存好的行数，注意的是，当</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">count(*)</span><span style="font-size: 10pt; font-family: 宋体; color: black;">语句包含</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"> where</span><span style="font-size: 10pt; font-family: 宋体; color: black;">条件时，两种表的操作是一样的</span></td>
<td style="padding: 0cm 5.4pt; width: 131pt; border: medium 1pt 1pt medium none solid solid none -moz-use-text-color black black -moz-use-text-color;" width="175" valign="top"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">InnoDB </span><span style="font-size: 10pt; font-family: 宋体; color: black;">中不 保存表的具体行数，也就是说，执行</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">select  count(*) from table</span><span style="font-size: 10pt; font-family: 宋体; color: black;">时，</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">InnoDB</span><span style="font-size: 10pt; font-family: 宋体; color: black;">要扫描一遍整个表来计算有多少行</span></td>
</tr>
<tr>
<td style="padding: 0cm 5.4pt; width: 90.45pt; border: medium 1pt  1pt none solid solid -moz-use-text-color black black;" width="121" valign="top"><strong><span style="font-size: 10pt; font-family: 宋体; color: black;">锁</span></strong><strong> </strong></td>
<td style="padding: 0cm 5.4pt; width: 204.65pt; border: medium 1pt 1pt medium none solid solid none -moz-use-text-color black black -moz-use-text-color;" width="273" valign="top"><span style="font-size: 10pt; font-family: 宋体; color: black;">表锁</span></td>
<td style="padding: 0cm 5.4pt; width: 131pt; border: medium 1pt 1pt medium none solid solid none -moz-use-text-color black black -moz-use-text-color;" width="175" valign="top"><span style="font-size: 10pt; font-family: 宋体; color: black;">提供行锁</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">(locking  on row level)</span><span style="font-size: 10pt; font-family: 宋体; color: black;">，提供与</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"> Oracle </span><span style="font-size: 10pt; font-family: 宋体; color: black;">类型一致的不加锁读取</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">(non-locking  read in<br />
SELECTs)</span><span style="font-size: 10pt; font-family: 宋体; color: black;">，另外，</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">InnoDB</span><span style="font-size: 10pt; font-family: 宋体; color: black;">表的行锁也不是绝对的，如果在执 行一个</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">SQL</span><span style="font-size: 10pt; font-family: 宋体; color: black;">语句时</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">MySQL</span><span style="font-size: 10pt; font-family: 宋体; color: black;">不能确定要扫描的范围，</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">InnoDB</span><span style="font-size: 10pt; font-family: 宋体; color: black;">表同样会锁全表，例如</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">update  table set num=1 where name like “%aaa%”</span></td>
</tr>
<tr>
<td style="padding: 0cm 5.4pt; width: 426.1pt; border: medium 1pt  1pt none solid solid -moz-use-text-color black black;" colspan="3" width="568" valign="top"><span style="font-size: 10pt; font-family: 宋体; color: black;">本文原出处为</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"> <span lang="EN-US"><a href="http://2005yangdehua.blog.163.com/">h</a>ttp://www.dbahacker.com</span></span></p>
<p><span style="font-size: 10pt; font-family: 宋体; color: black;">转载烦请保留 链接</span></td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://dbahacker.com/mysql/innodb-myisam-compare/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>5月第三周关键词 慢语句处理</title>
		<link>http://dbahacker.com/mysql/5%e6%9c%88%e7%ac%ac%e4%b8%89%e5%91%a8%e5%85%b3%e9%94%ae%e8%af%8d-%e6%85%a2%e8%af%ad%e5%8f%a5%e5%a4%84%e7%90%86</link>
		<comments>http://dbahacker.com/mysql/5%e6%9c%88%e7%ac%ac%e4%b8%89%e5%91%a8%e5%85%b3%e9%94%ae%e8%af%8d-%e6%85%a2%e8%af%ad%e5%8f%a5%e5%a4%84%e7%90%86#comments</comments>
		<pubDate>Fri, 21 May 2010 14:09:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://dbahacker.com/?p=102</guid>
		<description><![CDATA[依稀记得是上周开始部署了mysql的节点监控程序到线上环境，设定的查询周期是90秒一次，超过10秒的查询和超过x个连接的时候就会发报警邮件给DBA。 这个在镜像库部署的时候，会经常发现开发人员查一下没用索引的语句或者没有limit n的语句，这些没语句会对数据库造成很大的影响，例如一个几千万条记录的大表要全部扫描，或者是不停的做filesort，对数据库和服务器造成io影响等。这是镜像库上面的情况。 而到了线上库，除了出现没有索引的语句，没有用limit的语句，还多了一个情况,mysql连接数过多的问题。说到这里，先来看看以前我们的监控做法 1. 部署zabbix等开源分布式监控系统，获取每天的数据库的io，cpu，连接数 2. 部署每周性能统计，包含数据增加量，iostat，vmstat，datasize的情况 3. Mysql slowlog收集，列出top 10 以前以为做了这些监控已经是很完美了，现在部署了mysql节点进程监控之后，才发现很多弊端 第一种做法的弊端: zabbix太庞大，而且不是在mysql内部做的监控，很多数据不是非常准备，现在一般都是用来查阅历史的数据情况 第二种做法的弊端：因为是每周只跑一次，很多情况没法发现和报警 第三种做法的弊端: 当节点的slowlog非常多的时候，top10就变得没意义了，而且很多时候会给出那些是一定要跑的定期任务语句给你。。参考的价值不大 最后总结一下节点监控的好处 1． 轻量级的监控，而且是实时的，还可以根据实际的情况来定制和修改 2． 设置了过滤程序，可以对那些一定要跑的语句进行过滤 3． 及时发现那些没有用索引，或者是不合法的查询，虽然这很耗时去处理那些慢语句，但这样可以避免数据库挂掉，还是值得的 4.  在数据库出现连接数过多的时候，程序会自动保存当前数据库的processlist，DBA进行原因查找的时候这可是利器 5.  使用mysqlbinlog 来分析的时候，可以得到明确的数据库状态异常的时间段]]></description>
			<content:encoded><![CDATA[<p style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 21pt; padding: 0px;"><span style="line-height: 22px; font-family: 宋体;">依稀记得是上周开始部署了</span><span style="line-height: 22px;" lang="EN-US">mysql</span><span style="line-height: 22px; font-family: 宋体;">的节点监控程序到线上环境，设定的查询周期是</span><span style="line-height: 22px;" lang="EN-US">90</span><span style="line-height: 22px; font-family: 宋体;">秒一次，超过</span><span style="line-height: 22px;" lang="EN-US">10</span><span style="line-height: 22px; font-family: 宋体;">秒的查询和超过</span><span style="line-height: 22px;" lang="EN-US">x</span><span style="line-height: 22px; font-family: 宋体;">个连接的时候就会发报警邮件给</span><span style="line-height: 22px;" lang="EN-US">DBA</span><span style="line-height: 22px; font-family: 宋体;">。</span></p>
<p style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;"><span style="line-height: 22px;" lang="EN-US"><span style="line-height: 22px;"> </span></span><span style="line-height: 22px; font-family: 宋体;">这个在镜像库部署的时候，会<strong style="line-height: 22px;">经常发现开发人员查一下没用索引的语句或者没有</strong></span><span style="line-height: 22px;" lang="EN-US"><strong style="line-height: 22px;">limit n</strong></span><span style="line-height: 22px; font-family: 宋体;"><strong style="line-height: 22px;">的语句，这些没语句会对数据库造成很大的影响，例如一个几千万条记录的大表要全部扫描，或者是不停的做</strong></span><span style="line-height: 22px;" lang="EN-US"><strong style="line-height: 22px;">filesort</strong></span><span style="line-height: 22px; font-family: 宋体;"><strong style="line-height: 22px;">，对数据库和服务器造成</strong></span><span style="line-height: 22px;" lang="EN-US"><strong style="line-height: 22px;">io</strong></span><span style="line-height: 22px; font-family: 宋体;"><strong style="line-height: 22px;">影响</strong>等。这是镜像库上面的情况。</span></p>
<p style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;"><span style="line-height: 22px;" lang="EN-US"><span style="line-height: 22px;"> </span></span><span style="line-height: 22px; font-family: 宋体;">而到了线上库，除了出现没有索引的语句，没有用</span><span style="line-height: 22px;" lang="EN-US">limit</span><span style="line-height: 22px; font-family: 宋体;">的语句，还多了一个情况</span><span style="line-height: 22px;" lang="EN-US">,<strong style="line-height: 22px;">mysql</strong></span><strong style="line-height: 22px;"><span style="line-height: 22px; font-family: 宋体;">连接数过多的问题。</span></strong><span style="line-height: 22px; font-family: 宋体;">说到这里，先来看看以前我们的监控做法</span></p>
<p style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 39pt; text-indent: -18pt; padding: 0px;"><span style="line-height: 22px;" lang="EN-US"><span style="line-height: 22px;">1.<span style="line-height: 22px;"> </span></span></span><span style="line-height: 22px; font-family: 宋体;">部署</span><span style="line-height: 22px;" lang="EN-US">zabbix</span><span style="line-height: 22px; font-family: 宋体;">等开源分布式监控系统，获取每天的数据库的</span><span style="line-height: 22px;" lang="EN-US">io</span><span style="line-height: 22px; font-family: 宋体;">，</span><span style="line-height: 22px;" lang="EN-US">cpu</span><span style="line-height: 22px; font-family: 宋体;">，连接数</span></p>
<p style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 39pt; text-indent: -18pt; padding: 0px;"><span style="line-height: 22px;" lang="EN-US"><span style="line-height: 22px;">2.<span style="line-height: 22px;"> </span></span></span><span style="line-height: 22px; font-family: 宋体;">部署每周性能统计，包含数据增加量，</span><span style="line-height: 22px;" lang="EN-US">iostat</span><span style="line-height: 22px; font-family: 宋体;">，</span><span style="line-height: 22px;" lang="EN-US">vmstat</span><span style="line-height: 22px; font-family: 宋体;">，</span><span style="line-height: 22px;" lang="EN-US">datasize</span><span style="line-height: 22px; font-family: 宋体;">的情况</span></p>
<p style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 39pt; text-indent: -18pt; padding: 0px;"><span style="line-height: 22px;" lang="EN-US"><span style="line-height: 22px;">3.<span style="line-height: 22px;"> </span></span></span><span style="line-height: 22px;" lang="EN-US">Mysql slowlog</span><span style="line-height: 22px; font-family: 宋体;">收集，列出</span><span style="line-height: 22px;" lang="EN-US">top 10</span></p>
<p style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;"><span style="line-height: 22px;" lang="EN-US"> </span></p>
<p style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;"><span style="line-height: 22px; font-family: 宋体;">以前以为做了这些监控已经是很完美了，现在部署了</span><span style="line-height: 22px;" lang="EN-US">mysql</span><span style="line-height: 22px; font-family: 宋体;">节点进程监控之后，才发现很多弊端</span></p>
<p style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;"><span style="line-height: 22px; font-family: 宋体;">第一种做法的弊端</span><span style="line-height: 22px;" lang="EN-US">: zabbix</span><span style="line-height: 22px; font-family: 宋体;">太庞大，而且不是在</span><span style="line-height: 22px;" lang="EN-US">mysql</span><span style="line-height: 22px; font-family: 宋体;">内部做的监控，很多数据不是非常准备，现在一般都是用来查阅历史的数据情况</span></p>
<p style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;"><span style="line-height: 22px; font-family: 宋体;">第二种做法的弊端：因为是每周只跑一次，很多情况没法发现和报警</span></p>
<p style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;"><span style="line-height: 22px; font-family: 宋体;">第三种做法的弊端</span><span style="line-height: 22px;" lang="EN-US">: </span><span style="line-height: 22px; font-family: 宋体;">当节点的</span><span style="line-height: 22px;" lang="EN-US">slowlog</span><span style="line-height: 22px; font-family: 宋体;">非常多的时候，</span><span style="line-height: 22px;" lang="EN-US">top10</span><span style="line-height: 22px; font-family: 宋体;">就变得没意义了，而且很多时候会给出那些是一定要跑的定期任务语句给你。。参考的价值不大</span></p>
<p style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;"><span style="line-height: 22px;" lang="EN-US"> </span></p>
<p style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;"><strong style="line-height: 22px;"><span style="line-height: 22px; font-family: 宋体;">最后总结一下节点监控的好处</span><span style="line-height: 22px;" lang="EN-US"> </span></strong></p>
<p style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 39pt; text-indent: -18pt; padding: 0px;"><span style="line-height: 22px;" lang="EN-US"><span style="line-height: 22px;">1．<span style="line-height: 22px;"> </span></span></span><span style="line-height: 22px; font-family: 宋体;">轻量级的监控，而且是实时的，还可以根据实际的情况来定制和修改</span></p>
<p style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 39pt; text-indent: -18pt; padding: 0px;"><span style="line-height: 22px;" lang="EN-US"><span style="line-height: 22px;">2．<span style="line-height: 22px;"> </span></span></span><span style="line-height: 22px; font-family: 宋体;">设置了过滤程序，可以对那些一定要跑的语句进行过滤</span></p>
<p style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 39pt; text-indent: -18pt; padding: 0px;"><span style="line-height: 22px;" lang="EN-US"><span style="line-height: 22px;">3．<span style="line-height: 22px;"> </span></span></span><span style="line-height: 22px; font-family: 宋体;">及时发现那些没有用索引，或者是不合法的查询，虽然这很耗时去处理那些慢语句，但这样可以避免数据库挂掉，还是值得的</span></p>
<p style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 39pt; text-indent: -18pt; padding: 0px;"><span style="line-height: 22px; font-family: 宋体;">4.  在数据库出现连接数过多的时候，程序会自动保存当前数据库的processlist，DBA进行原因查找的时候这可是利器</span></p>
<p style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 39pt; text-indent: -18pt; padding: 0px;"><span style="line-height: 22px; font-family: 宋体;">5.  使用mysqlbinlog 来分析的时候，可以得到明确的数据库状态异常的时间段</span></p>
]]></content:encoded>
			<wfw:commentRss>http://dbahacker.com/mysql/5%e6%9c%88%e7%ac%ac%e4%b8%89%e5%91%a8%e5%85%b3%e9%94%ae%e8%af%8d-%e6%85%a2%e8%af%ad%e5%8f%a5%e5%a4%84%e7%90%86/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL5.5的亮点 和MySQL Cluster 7.1介绍</title>
		<link>http://dbahacker.com/mysql/mysql-5-5-mysqlcluster-7-1</link>
		<comments>http://dbahacker.com/mysql/mysql-5-5-mysqlcluster-7-1#comments</comments>
		<pubDate>Sat, 08 May 2010 02:42:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://dbahacker.com/?p=94</guid>
		<description><![CDATA[MySQL5.5亮点 InnoDB 多个缓冲池实例 多个回滚段 扩展变化和清除缓冲调度 Improved Log Sys and Flush List mutex 改善日志系统 改进锁策略 改进InnoDB互斥，读写锁，线程和I/O操作的策略 改进win32，64平台下的性能/规模 扩展到32个内核 半同步复制 性能架构 SIGNAL/RESIGNAL (finally!) 新的增强分区 Configuring the heartbeat period More than 10x improvement in recovery times 200% performance gain for MySQL 5.5 over 5.1.40 MySQL Cluster 7.1 (GA) NDBINFO &#8211; improved real time status and usage statistics MYSQL [...]]]></description>
			<content:encoded><![CDATA[<p><strong>MySQL5.5亮点</strong></p>
<p>InnoDB</p>
<ol>
<li>多个缓冲池实例</li>
<li>多个回滚段</li>
<li>扩展变化和清除缓冲调度</li>
<li>Improved Log Sys and Flush List mutex 改善日志系统</li>
<li>改进锁策略</li>
<li>改进InnoDB互斥，读写锁，线程和I/O操作的策略</li>
</ol>
<p style="text-align: left; ">改进win32，64平台下的性能/规模</p>
<p style="text-align: left; ">扩展到32个内核</p>
<p style="text-align: left; ">半同步复制</p>
<p style="text-align: left; ">性能架构</p>
<p style="text-align: left; ">SIGNAL/RESIGNAL (finally!)</p>
<p style="text-align: left; ">新的增强分区</p>
<p style="text-align: left; ">Configuring the heartbeat period</p>
<p style="text-align: left; ">More than 10x improvement in recovery times</p>
<p style="text-align: left; ">200% performance gain for MySQL 5.5 over 5.1.40</p>
<p style="text-align: left; ">
<p style="text-align: left; "><strong>MySQL Cluster 7.1 (GA)</strong></p>
<ul>
<li>NDBINFO &#8211; improved real time status and usage statistics</li>
<li>MYSQL Cluster Manager (CGE only)</li>
<li>Sub-second failover and self healing recovery</li>
<li>Parallel multi-master architecture</li>
<li>Low latency &#8211; real time responsiveness</li>
</ul>
<p style="text-align: left; ">
<p style="text-align: left; ">
]]></content:encoded>
			<wfw:commentRss>http://dbahacker.com/mysql/mysql-5-5-mysqlcluster-7-1/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

