{"id":176391,"date":"2024-11-08T11:59:18","date_gmt":"2024-11-08T03:59:18","guid":{"rendered":"https:\/\/server.hk\/cnblog\/176391\/"},"modified":"2024-11-08T11:59:19","modified_gmt":"2024-11-08T03:59:19","slug":"%e5%a6%82%e4%bd%95%e4%bf%ae%e5%be%a9mysql%e9%8c%af%e8%aa%a4-er_sync_thread_cant_create","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/176391\/","title":{"rendered":"\u5982\u4f55\u4fee\u5fa9MySQL\u932f\u8aa4 &#8211; ER_SYNC_THREAD_CANT_CREATE"},"content":{"rendered":"<h1 id=\"%e5%a6%82%e4%bd%95%e4%bf%ae%e5%be%a9mysql%e9%8c%af%e8%aa%a4-er_sync_thread_cant_create-LhScdRScaP\">\u5982\u4f55\u4fee\u5fa9MySQL\u932f\u8aa4 &#8211; ER_SYNC_THREAD_CANT_CREATE<\/h1>\n<p>\u5728\u4f7f\u7528MySQL\u6578\u64da\u5eab\u6642\uff0c\u60a8\u53ef\u80fd\u6703\u9047\u5230\u5404\u7a2e\u932f\u8aa4\uff0c\u5176\u4e2d\u4e4b\u4e00\u662f <code>ER_SYNC_THREAD_CANT_CREATE<\/code>\u3002\u9019\u500b\u932f\u8aa4\u901a\u5e38\u8207MySQL\u7684\u540c\u6b65\u57f7\u884c\u7dd2\u7121\u6cd5\u5275\u5efa\u6709\u95dc\uff0c\u53ef\u80fd\u6703\u5c0e\u81f4\u6578\u64da\u5eab\u7684\u904b\u884c\u53d7\u5230\u5f71\u97ff\u3002\u672c\u6587\u5c07\u63a2\u8a0e\u9019\u500b\u932f\u8aa4\u7684\u539f\u56e0\u53ca\u5176\u89e3\u6c7a\u65b9\u6848\uff0c\u5e6b\u52a9\u60a8\u6709\u6548\u5730\u4fee\u5fa9\u554f\u984c\u3002<\/p>\n<h2 id=\"%e9%8c%af%e8%aa%a4%e5%8e%9f%e5%9b%a0%e5%88%86%e6%9e%90-LhScdRScaP\">\u932f\u8aa4\u539f\u56e0\u5206\u6790<\/h2>\n<p>\u5728\u6df1\u5165\u63a2\u8a0e\u89e3\u6c7a\u65b9\u6848\u4e4b\u524d\uff0c\u4e86\u89e3 <code>ER_SYNC_THREAD_CANT_CREATE<\/code> \u932f\u8aa4\u7684\u6839\u672c\u539f\u56e0\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002\u9019\u500b\u932f\u8aa4\u901a\u5e38\u51fa\u73fe\u5728\u4ee5\u4e0b\u5e7e\u7a2e\u60c5\u6cc1\u4e0b\uff1a<\/p>\n<ul>\n<li><strong>\u7cfb\u7d71\u8cc7\u6e90\u4e0d\u8db3\uff1a<\/strong>\u5982\u679c\u60a8\u7684\u4f3a\u670d\u5668\u8cc7\u6e90\uff08\u5982\u5167\u5b58\u6216CPU\uff09\u4e0d\u8db3\uff0cMySQL\u53ef\u80fd\u7121\u6cd5\u5275\u5efa\u65b0\u7684\u57f7\u884c\u7dd2\u3002<\/li>\n<li><strong>\u914d\u7f6e\u554f\u984c\uff1a<\/strong>MySQL\u7684\u914d\u7f6e\u6587\u4ef6\uff08\u5982 <code>my.cnf<\/code>\uff09\u4e2d\u7684\u67d0\u4e9b\u8a2d\u7f6e\u53ef\u80fd\u4e0d\u6b63\u78ba\uff0c\u5c0e\u81f4\u57f7\u884c\u7dd2\u7121\u6cd5\u5275\u5efa\u3002<\/li>\n<li><strong>\u64cd\u4f5c\u7cfb\u7d71\u9650\u5236\uff1a<\/strong>\u67d0\u4e9b\u64cd\u4f5c\u7cfb\u7d71\u5c0d\u65bc\u9032\u7a0b\u548c\u57f7\u884c\u7dd2\u7684\u6578\u91cf\u6709\u56b4\u683c\u7684\u9650\u5236\uff0c\u9019\u53ef\u80fd\u6703\u5f71\u97ffMySQL\u7684\u904b\u884c\u3002<\/li>\n<\/ul>\n<h2 id=\"%e8%a7%a3%e6%b1%ba%e6%96%b9%e6%a1%88-LhScdRScaP\">\u89e3\u6c7a\u65b9\u6848<\/h2>\n<p>\u91dd\u5c0d <code>ER_SYNC_THREAD_CANT_CREATE<\/code> \u932f\u8aa4\uff0c\u60a8\u53ef\u4ee5\u63a1\u53d6\u4ee5\u4e0b\u5e7e\u500b\u6b65\u9a5f\u4f86\u9032\u884c\u4fee\u5fa9\uff1a<\/p>\n<h3 id=\"1-%e6%aa%a2%e6%9f%a5%e7%b3%bb%e7%b5%b1%e8%b3%87%e6%ba%90-LhScdRScaP\">1. \u6aa2\u67e5\u7cfb\u7d71\u8cc7\u6e90<\/h3>\n<p>\u9996\u5148\uff0c\u60a8\u9700\u8981\u6aa2\u67e5\u4f3a\u670d\u5668\u7684\u8cc7\u6e90\u4f7f\u7528\u60c5\u6cc1\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u67e5\u770b\u5167\u5b58\u548cCPU\u7684\u4f7f\u7528\u60c5\u6cc1\uff1a<\/p>\n<pre><code>top<\/code><\/pre>\n<p>\u5982\u679c\u767c\u73fe\u8cc7\u6e90\u4f7f\u7528\u7387\u904e\u9ad8\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u8003\u616e\u5347\u7d1a\u4f3a\u670d\u5668\u6216\u512a\u5316\u61c9\u7528\u7a0b\u5e8f\u4ee5\u6e1b\u5c11\u8cc7\u6e90\u6d88\u8017\u3002<\/p>\n<h3 id=\"2-%e8%aa%bf%e6%95%b4mysql%e9%85%8d%e7%bd%ae-LhScdRScaP\">2. \u8abf\u6574MySQL\u914d\u7f6e<\/h3>\n<p>\u6aa2\u67e5MySQL\u7684\u914d\u7f6e\u6587\u4ef6\uff08\u901a\u5e38\u4f4d\u65bc <code>\/etc\/my.cnf<\/code> \u6216 <code>\/etc\/mysql\/my.cnf<\/code>\uff09\u4e2d\u7684\u4ee5\u4e0b\u53c3\u6578\uff1a<\/p>\n<ul>\n<li><code>thread_cache_size<\/code>: \u589e\u52a0\u6b64\u503c\u53ef\u4ee5\u63d0\u9ad8\u57f7\u884c\u7dd2\u7684\u91cd\u7528\u7387\u3002<\/li>\n<li><code>max_connections<\/code>: \u78ba\u4fdd\u6b64\u503c\u8db3\u5920\u9ad8\uff0c\u4ee5\u652f\u6301\u60a8\u7684\u61c9\u7528\u7a0b\u5e8f\u9700\u6c42\u3002<\/li>\n<\/ul>\n<p>\u4fee\u6539\u5f8c\uff0c\u91cd\u555fMySQL\u670d\u52d9\u4ee5\u4f7f\u66f4\u6539\u751f\u6548\uff1a<\/p>\n<pre><code>sudo systemctl restart mysql<\/code><\/pre>\n<h3 id=\"3-%e6%aa%a2%e6%9f%a5%e6%93%8d%e4%bd%9c%e7%b3%bb%e7%b5%b1%e9%99%90%e5%88%b6-LhScdRScaP\">3. \u6aa2\u67e5\u64cd\u4f5c\u7cfb\u7d71\u9650\u5236<\/h3>\n<p>\u5728\u67d0\u4e9b\u60c5\u6cc1\u4e0b\uff0c\u64cd\u4f5c\u7cfb\u7d71\u5c0d\u65bc\u9032\u7a0b\u548c\u57f7\u884c\u7dd2\u7684\u6578\u91cf\u6709\u56b4\u683c\u7684\u9650\u5236\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6aa2\u67e5\u7576\u524d\u7684\u9650\u5236\uff1a<\/p>\n<pre><code>ulimit -u<\/code><\/pre>\n<p>\u5982\u679c\u9700\u8981\uff0c\u60a8\u53ef\u4ee5\u901a\u904e\u7de8\u8f2f <code>\/etc\/security\/limits.conf<\/code> \u6587\u4ef6\u4f86\u589e\u52a0\u9019\u4e9b\u9650\u5236\u3002\u4f8b\u5982\uff1a<\/p>\n<pre><code>* soft nproc 4096\n* hard nproc 4096<\/code><\/pre>\n<p>\u4fee\u6539\u5f8c\uff0c\u91cd\u65b0\u555f\u52d5\u4f3a\u670d\u5668\u4ee5\u4f7f\u66f4\u6539\u751f\u6548\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-LhScdRScaP\">\u7e3d\u7d50<\/h2>\n<p>\u4fee\u5fa9 <code>ER_SYNC_THREAD_CANT_CREATE<\/code> \u932f\u8aa4\u9700\u8981\u5c0d\u7cfb\u7d71\u8cc7\u6e90\u3001MySQL\u914d\u7f6e\u548c\u64cd\u4f5c\u7cfb\u7d71\u9650\u5236\u9032\u884c\u5168\u9762\u6aa2\u67e5\u548c\u8abf\u6574\u3002\u901a\u904e\u9019\u4e9b\u6b65\u9a5f\uff0c\u60a8\u61c9\u8a72\u80fd\u5920\u6709\u6548\u5730\u89e3\u6c7a\u6b64\u554f\u984c\uff0c\u78ba\u4fddMySQL\u6578\u64da\u5eab\u7684\u7a69\u5b9a\u904b\u884c\u3002\u5982\u679c\u60a8\u9700\u8981\u9032\u4e00\u6b65\u7684\u652f\u6301\u6216\u5c0b\u627e\u9ad8\u6548\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u89e3\u6c7a\u65b9\u6848\uff0c\u8acb\u8003\u616e\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u4ee5\u7372\u53d6\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e86\u89e3\u5982\u4f55\u4fee\u5fa9MySQL\u932f\u8aa4ER_SYNC_THREAD_CANT_CREATE\uff0c\u89e3\u6c7a\u540c\u6b65\u57f7\u884c\u7dd2\u7121\u6cd5\u5275\u5efa\u7684\u554f\u984c\uff0c\u78ba\u4fdd\u6578\u64da\u5eab\u6b63\u5e38\u904b\u884c\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-176391","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/176391","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=176391"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/176391\/revisions"}],"predecessor-version":[{"id":176392,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/176391\/revisions\/176392"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=176391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=176391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=176391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}