{"id":5353,"date":"2020-07-29T21:32:19","date_gmt":"2020-07-29T13:32:19","guid":{"rendered":"http:\/\/39.97.231.10\/?p=5353"},"modified":"2020-07-29T21:32:19","modified_gmt":"2020-07-29T13:32:19","slug":"mysql-8-0-oomout-of-memory-%e9%97%ae%e9%a2%98%e4%bc%98%e5%8c%96","status":"publish","type":"post","link":"http:\/\/www.weijing.co\/?p=5353","title":{"rendered":"MySQL 8.0 OOM(Out Of Memory) \u95ee\u9898\u4f18\u5316"},"content":{"rendered":"<div class=\\\"blog_content\\\">\n<div class=\\\"blog_detail\\\">\n<div>\n<p>\u4e91\u4e3b\u673a\uff0c1\u68381G\uff0c\u642d\u5efa\u4e2a\u4eba\u535a\u5ba2\u7f51\u7ad9\uff0c\u540e\u53f0\u6570\u636e\u5e93\u4f7f\u7528MySQL 8.0.17\u7248\u672c\uff0c\u7ecf\u5e38\u9047\u5230MySQL \u8fdb\u7a0b OOM(Out Of Memory) \u88ab\u6740\u6389\uff0c\u7ecf\u8fc7\u6392\u67e5\u4f18\u5316\uff0c\u7ec8\u4e8e\u53d1\u73b0\u95ee\u9898\u5e76\u987a\u5229\u89e3\u51b3\u3002<\/p>\n<p><strong>\u8f6f\u786c\u4ef6\u914d\u7f6e\uff1a<\/strong><\/p>\n<ul>\n<li>CentOS 7 1\u68381G<\/li>\n<li>MySQL 8.0.17<\/li>\n<li>PHP 7<\/li>\n<\/ul>\n<p>\u4e00\u822c\u6765\u8bf4\u8fdb\u7a0bOOM\uff0c\u4e3b\u8981\u539f\u56e0\u5c31\u662f\u5185\u5b58\u4e0d\u8db3\uff0cMySQL \u4ece 5.1 \u5230 5.5\uff0c 5.6\uff0c 5.7 \u4ee5\u53ca\u76ee\u524d\u76848.0\u7248\u672c\uff0c\u529f\u80fd\u8d8a\u6765\u8d8a\u5f3a\u5927\uff0c\u6027\u80fd\u4e5f\u8d8a\u6765\u8d8a\u9ad8\uff0c\u4f46\u662f\u5360\u7528\u7684\u5185\u5b58\u4e5f\u8d8a\u6765\u8d8a\u5927\uff0c\u56e0\u6b64\u4f18\u5316\u7684\u5173\u952e\u70b9\u5728\u4e8e\u51cf\u5c11MySQL\u7684\u5185\u5b58\u5360\u7528\u3002<\/p>\n<p><strong>\u4f18\u5316\u4e00\uff1ainnodb_buffer_pool_size\u8bbe\u7f6e\u4e3a\u6700\u5c0f128M<\/strong><br \/>innodb_buffer_pool_size \u662fMySQL\u5185\u5b58\u5360\u7528\u7684\u5927\u6237\uff0c\u9996\u5148\u62ff\u5b83\u5f00\u5200\uff0c\u8bbe\u7f6e\u4e3a\u6700\u5c0f\u7684128M\u3002\u5728\u6211\u76841G\u5185\u5b58\u7684\u4e91\u4e3b\u673a\u4e0a\uff0c\u8bbe\u7f6e\u4e3a128M\u4e4b\u540e\uff0cMySQL 8.0 \u4ecd\u7136\u4f1a\u5c0f\u6982\u7387OOM\uff0c\u6ca1\u529e\u6cd5\uff0c\u7ee7\u7eed\u4f18\u5316\u3002<\/p>\n<p><strong>\u4f18\u5316\u4e8c\uff1a\u5173\u95edperformance_schema<\/strong><br \/>performance_schema\u8bbe\u7f6e\u4e3aOFF\uff0c\u5373\u5173\u95edperformance_schema\u4e2d\u7684\u5404\u9879\u6027\u80fd\u76d1\u63a7\u3002\u5173\u95ed\u4e4b\u540e\uff0cMySQL 8.0 \u8fd0\u884c\u4e00\u5468\u591a\u65f6\u95f4\uff0c\u6ca1\u6709\u53d1\u751fOOM\u3002performance_schema\u529f\u80fd\u5728\u5e26\u7ed9\u6211\u4eec\u66f4\u591a\u6027\u80fd\u76d1\u63a7\u624b\u6bb5\u7684\u540c\u65f6\uff0c\u4e5f\u5360\u7528\u4e86\u592a\u591a\u7684\u5185\u5b58\uff0c\u770b\u6765\u5b83\u662f\u5f15\u8d77MySQL OOM\u7684\u4e3b\u8981\u539f\u56e0\u3002<\/p>\n<p><strong>\u4f18\u5316\u4e09\uff1a\u8c03\u4f4e\u5404\u79cdbuffer,cache\u53c2\u6570<\/strong><br \/>\u5404\u79cdbuffer, cache \u53c2\u6570\uff0c\u5c3d\u91cf\u8bbe\u7f6e\u7684\u5c0f\u4e00\u70b9\uff0c\u53cd\u6b63\u4e2a\u4eba\u7f51\u7ad9\uff0c\u8bbf\u95ee\u91cf\u4e5f\u4e0d\u9ad8\uff0c\u5e76\u4e0d\u9700\u8981\u592a\u9ad8\u7684MySQL\u6027\u80fd\uff0c\u53ea\u8981\u4e0d\u7ecf\u5e38OOM\uff0c\u80fd\u7a33\u5b9a\u8fd0\u884c\u5c31\u597d\u3002<\/p>\n<p>\u6bd4\u5982\uff1a<br \/>innodb_log_buffer_size<br \/>innodb_sort_buffer_size<br \/>join_buffer_size<br \/>key_buffer_size<br \/>myisam_sort_buffer_size<br \/>sort_buffer_size<br \/>binlog_cache_size<br \/>\u7b49\u7b49<\/p>\n<p><strong>\u4f18\u5316\u56db\uff1a\u5173\u95ed\u4e0d\u9700\u8981\u7684\u529f\u80fd<\/strong><br \/>\u6bd4\u5982\u6211\u7684\u4e2a\u4eba\u7f51\u7ad9\uff0cMySQL\u5355\u5b9e\u4f8b\uff0c\u4e0d\u9700\u8981\u4e3b\u4ece\u590d\u5236\uff0c\u53ef\u4ee5\u5173\u95edmysql\u7684binlog\u529f\u80fd\uff0c\u4ece\u800c\u964d\u4f4e\u5185\u5b58\u4f7f\u7528\uff0c\u63d0\u9ad8\u6027\u80fd\u3002\u5728my.cnf\u914d\u7f6e\u6587\u4ef6\u91cc\u52a0\u4e0askip-log-bin\u53c2\u6570\u5373\u53ef\u3002<br \/>\u5176\u4ed6\u7528\u4e0d\u5230\u7684\u529f\u80fd\uff0c\u90fd\u53ef\u4ee5\u5173\u95ed\uff0c\u4ee5\u964d\u4f4e\u5185\u5b58\u4f7f\u7528\uff0c\u63d0\u9ad8\u6027\u80fd\u3002<\/p>\n<\/div>\n<\/div>\n<\/div>\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e91\u4e3b\u673a\uff0c1\u68381G\uff0c\u642d\u5efa\u4e2a\u4eba\u535a\u5ba2\u7f51\u7ad9\uff0c\u540e\u53f0\u6570\u636e\u5e93\u4f7f\u7528MySQL 8.0.17\u7248\u672c\uff0c\u7ecf\u5e38\u9047\u5230MySQL \u8fdb\u7a0b OO &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"http:\/\/www.weijing.co\/?p=5353\"> <span class=\"screen-reader-text\">MySQL 8.0 OOM(Out Of Memory) \u95ee\u9898\u4f18\u5316<\/span> \u67e5\u770b\u5168\u6587 &raquo;<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":""},"categories":[90,88],"tags":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"mailpoet_newsletter_max":false,"woocommerce_thumbnail":false,"woocommerce_single":false,"woocommerce_gallery_thumbnail":false,"shop_catalog":false,"shop_single":false,"shop_thumbnail":false},"uagb_author_info":{"display_name":"weijing","author_link":"http:\/\/www.weijing.co\/?author=4"},"uagb_comment_info":0,"uagb_excerpt":"\u4e91\u4e3b\u673a\uff0c1\u68381G\uff0c\u642d\u5efa\u4e2a\u4eba\u535a\u5ba2\u7f51\u7ad9\uff0c\u540e\u53f0\u6570\u636e\u5e93\u4f7f\u7528MySQL 8.0.17\u7248\u672c\uff0c\u7ecf\u5e38\u9047\u5230MySQL \u8fdb\u7a0b OO&hellip;","_links":{"self":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts\/5353"}],"collection":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5353"}],"version-history":[{"count":0,"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts\/5353\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5353"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}