{"id":839,"date":"2017-08-10T16:15:35","date_gmt":"2017-08-10T08:15:35","guid":{"rendered":"http:\/\/www.5x44.cn\/?p=839"},"modified":"2017-09-27T14:42:35","modified_gmt":"2017-09-27T06:42:35","slug":"mysql%e6%95%b0%e6%8d%ae%e5%ba%93innodb%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/www.5x44.cn\/?p=839","title":{"rendered":"mysql\u6570\u636e\u5e93InnoDB\u4ecb\u7ecd"},"content":{"rendered":"<p>\u5b58\u50a8\u5f15\u64ce\u5c31\u662f\u6570\u5b58\u50a8\u7684\u65b9\u5f0f\u3002<\/p>\n<p>myIsam\u7684\u6570\u636e\u8868\u53ef\u4ee5\u76f4\u63a5\u590d\u5236\u5230\u5176\u5b83\u7684\u5e93\u4e2d\u4f7f\u7528\uff0c\u4f46InnoDB\u7684\u4e0d\u884c\u3002<\/p>\n<p>\u7cfb\u7edf\u6587\u4ef6\uff1a<\/p>\n<p>ibdata1:\u6bcf\u4e2a\u6570\u636e\u5e93\u5b9e\u4f8b\u4e00\u4e2a\uff0c\u5b83\u662f\u7cfb\u7edf\u8868\u7a7a\u95f4\u6587\u4ef6\u3002<\/p>\n<p>redo log\u65e5\u5fd7\uff1aib_logfile0,ib_logfile1;<\/p>\n<p>.frm\u6587\u4ef6\uff1a\u8868\u7ed3\u6784\u6587\u4ef6\u3002<\/p>\n<p>.ibd\u6587\u4ef6\uff1a\u5b9e\u9645\u6570\u636e\u3002<\/p>\n<pre>\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td>ibdata1\u6587\u4ef6\u5b58\u653e\u4ec0\u4e48\uff1f<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>\u56de\u6eda\u6bb5<\/td>\r\n<td>\u4e8b\u52a1\u9694\u79bb\u6027\u8981\u6c42\uff0c\u8981\u8bfb\u5230\u524d\u9879<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>\u6240\u6709InnoDB\u8868\u7684\u5143\u6570\u636e\u4fe1\u606f<\/td>\r\n<td>\u8fd9\u4e5f\u662fInnoDB\u8868\u4e0d\u80fd\u76f4\u63a5copy\u7684\u539f\u56e0<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Double write, Insert buffer dump\u7b49\u7b49<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>\u81ea\u52a8\u6269\u5c55\u673a\u5236<\/td>\r\n<td>\u5728\u521d\u59cb\u65f6\uff0c\u53ef\u4ee5\u8bbe\u7f6eibdata1\u6587\u4ef6\u7684\u5927\u5c0f\u5c5e\u6027\uff0c\u5f53\u56de\u6eda\u6587\u6bb5\u8d85\u8fc7\u5b58\u50a8\u5927\u5c0f\u65f6\uff0cibdata1\u4f1a\u81ea\u52a8\u6269\u5c55\u5927\u5c0f\uff0c\u4f46\u662f\u8be5\u6587\u4ef6\u4e0d\u80fd\u6536\u7f29\u3002<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/pre>\n<h2>MySQL\u3001InnoDB\u5b9e\u4f8b\u521d\u59cb\u5316\u65f6\u5c31\u5e94\u8be5\u88ab\u914d\u7f6e\u7684\u53c2\u6570\uff1a<\/h2>\n<pre>\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td>\u53c2\u6570<\/td>\r\n<td>\u6837\u4f8b\u503c<\/td>\r\n<td>\u5907\u6ce8<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>innodb_data_home_dir<\/td>\r\n<td><\/td>\r\n<td>\u7cfb\u7edf\u8868\u7a7a\u95f4\u6587\u4ef6\uff08<strong><em>ibdata1<\/em><\/strong>\uff09\u7684\u76ee\u5f55\uff0c\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u503c\uff0c\u7cfb\u7edf\u8868\u7a7a\u95f4\u6587\u4ef6\u5c31\u4f1a\u5b58\u5728datadir\u76ee\u5f55\u4e0b<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>innodb_log_group_home_dir<\/td>\r\n<td><\/td>\r\n<td>\u8fd9\u4e2a\u6587\u4ef6\u5939\u5b58\u653einnoDB redo log\u6587\u4ef6\uff0c<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>innodb_data_file_path<\/td>\r\n<td>ibdata1:12M:autoextend<\/td>\r\n<td>ibdata1\u6587\u4ef6\u7684\u521d\u59cb\u5c5e\u6027\uff0cautoextend\u5c5e\u6027\u5f88\u91cd\u8981\uff0c\u7528\u4e8e\u81ea\u52a8\u6269\u5c55\u5927\u5c0f<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>innodb_autoextend_increment<\/td>\r\n<td>64<\/td>\r\n<td>\u5355\u4f4d\u662fM\uff0c\u503c\u592a\u5927\u4f1a\u9020\u6210\u6bcf\u6b21\u6269\u5c55\u7684\u6548\u7387\u5f88\u6162\uff0c\u503c\u592a\u5c0f\u53c8\u4f1a\u9891\u7e41\u7684\u6269\u5c55\u963b\u585e\u56de\u6eda\u6bb5\u4e8b\u4ef6<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>innodb_file_per_table<\/td>\r\n<td>1<\/td>\r\n<td>\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u8bbe\u7f6e\u62100\uff0c\u4e5f\u5c31\u662f\u4e0d\u5f00\u542f\u72b6\u6001\uff0c\u90a3\u4e48\u6240\u6709\u7684\u6570\u636e\u90fd\u4f1a\u5199\u5230ibdata1\u4e2d<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>innodb_log_file_size<\/td>\r\n<td>50331648<\/td>\r\n<td>\u8be5\u53c2\u6570\u6307\u7684\u662fredo log\u6587\u4ef6\u7684\u5927\u5c0f\uff0cMYSQL5.7\u4e2d\u9ed8\u8ba4\u503c50331648\uff0c\u5355\u4f4d\u5b57\u8282\u3002\uff08ib_logfile0,ib_logfile1\uff09<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>innodb_log_files_in_group<\/td>\r\n<td>2<\/td>\r\n<td>\u6bcf\u4e2a\u5b9e\u4f8b\u6709\u51e0\u4e2aredo log\u6587\u4ef6\u3002\u6587\u4ef6\u6700\u5927\uff08innodb_log_file_size * innodb_log_files_in_group\uff09512GB\u3002<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/pre>\n<p>redo log:\u4e00\u79cd\u57fa\u4e8e\u78c1\u76d8\u7684\u6570\u636e\u7ed3\u6784\uff0c\u7528\u4e8e\u707e\u96be\u6062\u590d(<strong><em>crash recovery<\/em><\/strong>)\uff0c\u6b63\u786e\u7684\u5904\u7406\u672a\u5b8c\u6210\u7684<strong>\u4e8b\u52a1<\/strong>\u5199\u6570\u636e\u64cd\u4f5c\u3002<\/p>\n<p>log file\uff1a<em><strong>ib_logfile<\/strong><\/em>N\u4e2d\u7684\u4e00\u4e2a\uff0c\u5b83\u7ec4\u6210\u4e86<em><strong>redo log<\/strong><\/em>\u3002\u6570\u636e\u4ece<em><strong>log buffer<\/strong><\/em>\u5185\u5b58\u533a\u57df\u5199\u5230\u8fd9\u4e9b\u6587\u4ef6\u4e2d\u3002<\/p>\n<p>InnoDB\u6570\u636e\u6587\u4ef6\u7684\u5b58\u50a8\u7ed3\u6784\uff1a<\/p>\n<ul>\n<li>\u7d22\u5f15\u7ec4\u7ec7\u8868\uff08\u805a\u7c07\u8868\uff09\uff0c\u4e0d\u540c\u4e8emyIsam\u7684\u5806\u8868\uff08\u6309\u987a\u5e8f\u5199\u5165\u6587\u4ef6\uff0c\u5148\u5199\u5165\u7684\u5728\u524d\u9762\uff09\uff0c\u4f7f\u7528\u5e73\u8861\u4e8c\u53c9\u6811\u7ed3\u6784\u3002<\/li>\n<li>\u6839\u636e\u8868\u903b\u8f91<strong>\u4e3b\u952e\u6392\u5e8f\u5199\u5165<\/strong>\uff0c\u6240\u6709\u7684\u503c\u90fd\u5728\u4e8c\u53c9\u6811\u7684\u53f6\u5b50\u8282\u70b9\u4e0a\u3002<\/li>\n<li>\u6570\u636e\u8282\u70b9\u6bcf\u987516K\u5927\u5c0f<\/li>\n<\/ul>\n<p>\u6240\u4ee5InnoDB\u8868\u6839\u636e\u4e3b\u952e\u5bfb\u5740\u901f\u5ea6\u5f88\u5feb\uff1b\u4e3b\u952e\u503c\u9012\u589e\u7684insert\u63d2\u5165\u6548\u7387\u8f83\u597d\uff0c\u56e0\u4e3a\u4e0d\u7528\u5bfb\u627e\u63d2\u5165\u4f4d\u7f6e\uff0c\u76f4\u63a5\u5728\u540e\u9762\u6269\u5c55\u53f6\u5b50\u8282\u70b9\u5c31\u53ef\u4ee5\uff0c\u53cd\u800c\u968f\u673a\u7684\u63d2\u5165\u64cd\u4f5c\u6548\u7387\u8f83\u5dee\uff1b\u5982\u679c\u8868\u6ca1\u6709\u4e3b\u952e\uff0c\u7cfb\u7edf\u4f1a\u968f\u673a\u5206\u914d\u4e00\u4e2a\u5b57\u7b26\u4e32\u505a\u4e3a\u4e3b\u952e\uff0c\u56e0\u6b64\uff0cInnoDB\u8868\u5fc5\u987b\u6307\u5b9a\u4e3b\u952e\uff0c\u5efa\u8bae\u4f7f\u7528\u81ea\u589e\u6570\u5b57\u3002<\/p>\n<h2>InnoDB\u6570\u636e\u5757\u7f13\u5b58\u6c60<\/h2>\n<ul>\n<li>\u6570\u636e\u7684\u8bfb\u5199\u5fc5\u987b\u7ecf\u8fc7\u7f13\u5b58\u6c60<\/li>\n<li>\u6570\u636e\u4ee5\u6574\u9875\uff0816K\uff09\u4e3a\u5355\u4f4d\u8bfb\u5230\u7f13\u5b58\u4e2d<\/li>\n<li>\u7f13\u5b58\u4e2d\u7684\u6570\u636e\u4ee5LRU\uff08\u6700\u8fd1\u6700\u5c11\u4f7f\u7528\uff09\u7b56\u7565\u6362\u51fa<\/li>\n<\/ul>\n<p>InnoDB Buffer Pool\u76f8\u5173\u53c2\u6570<\/p>\n<pre>\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td>\u53c2\u6570<\/td>\r\n<td>\u6837\u4f8b\u503c<\/td>\r\n<td>\u5907\u6ce8<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>innodb_buffer_pool_size<\/td>\r\n<td>134217728<\/td>\r\n<td>\u6839\u636e\u603b\u7269\u7406\u5185\u5b58\u8bbe\u7f6e\uff0c70%\u621610%\u7684\u7269\u7406\u603b\u5185\u5b58\u6570\u3002\u5982\u679c\u6570\u636e\u5e93\u4e3a\u72ec\u7acb\u7684\u670d\u52a1\u5668\u8bbe\u7f6e\u4e3a70%\u3002\u5355\u4f4d\uff1a\u5b57\u8282\u3002\u8fd9\u4e2a\u53d8\u91cf\u8981\u5728\u5b9e\u4f8b\u542f\u52a8\u524d\u6539\u53d8\u3002<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/pre>\n<h2>InnoDB\u6570\u636e\u6301\u4e45\u5316\u4e0e\u4e8b\u52a1\u65e5\u5fd7<\/h2>\n<pre>\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td>\u53c2\u6570<\/td>\r\n<td>\u6837\u4f8b\u503c<\/td>\r\n<td>\u5907\u6ce8<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>innodb_flush_log_at_trx_commit<\/td>\r\n<td>1<\/td>\r\n<td>0\uff1a\u6bcf\u96941s\u5199\u5165\u5e76\u6301\u4e45\u5316\u4e00\u6b21\u65e5\u5fd7\r\n\r\n1\uff1a\u6bcf\u6b21commit\u90fd\u5199\u5165\u5e76\u6301\u4e45\u5316\u65e5\u5fd7\r\n\r\n2\uff1a\u6bcf\u6b21\u63d0\u4ea4\u65e5\u5fd7\u5199\u5230\u7cfb\u7edf\u5185\u5b58\uff0c\u6bcf1s\u6301\u4e45\u5316\u4e00\u6b21<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/pre>\n<h2>InnoDB\u884c\u7ea7\u9501<\/h2>\n<ul>\n<li>\u5199\u4e0d\u963b\u585e\u8bfb\u64cd\u4f5c\uff0c\u5c31\u7b97\u5199\u64cd\u4f5c\u6539\u53d8\u4e86\u60f3\u8bfb\u7684\u8bb0\u5f55\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u56de\u6eda\u6bb5\u8bfb\u53d6\u524d\u9879\u7684\u65b9\u5f0f\u8bfb\u5230\u4e00\u81f4\u7684\u5185\u5bb9\u3002<\/li>\n<li>\u4e0d\u540c\u884c\u95f4\u7684\u5199\u4e92\u76f8\u4e0d\u963b\u585e<\/li>\n<li>\u5e76\u53d1\u6027\u80fd\u597d<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u5b58\u50a8\u5f15\u64ce\u5c31\u662f\u6570\u5b58\u50a8\u7684\u65b9\u5f0f\u3002 myIsam\u7684\u6570\u636e\u8868\u53ef\u4ee5\u76f4\u63a5\u590d\u5236\u5230\u5176\u5b83\u7684\u5e93\u4e2d\u4f7f\u7528\uff0c\u4f46InnoDB\u7684\u4e0d\u884c\u3002 \u7cfb\u7edf\u6587\u4ef6\uff1a ibdata1:\u6bcf\u4e2a\u6570\u636e\u5e93\u5b9e\u4f8b\u4e00\u4e2a\uff0c\u5b83\u662f\u7cfb\u7edf\u8868&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/www.5x44.cn\/?p=839\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37],"tags":[],"class_list":["post-839","post","type-post","status-publish","format-standard","hentry","category-mysql"],"_links":{"self":[{"href":"https:\/\/www.5x44.cn\/index.php?rest_route=\/wp\/v2\/posts\/839","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.5x44.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.5x44.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.5x44.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.5x44.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=839"}],"version-history":[{"count":8,"href":"https:\/\/www.5x44.cn\/index.php?rest_route=\/wp\/v2\/posts\/839\/revisions"}],"predecessor-version":[{"id":973,"href":"https:\/\/www.5x44.cn\/index.php?rest_route=\/wp\/v2\/posts\/839\/revisions\/973"}],"wp:attachment":[{"href":"https:\/\/www.5x44.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=839"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.5x44.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=839"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.5x44.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=839"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}