{"id":21925,"date":"2024-01-02T17:36:22","date_gmt":"2024-01-02T17:36:22","guid":{"rendered":"https:\/\/server.hk\/blog\/21925\/"},"modified":"2024-11-14T10:24:56","modified_gmt":"2024-11-14T02:24:56","slug":"how-to-fix-mongodb-error-code-12587-backgroundoperationinprogressfornamespace","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/21925\/","title":{"rendered":"\u5982\u4f55\u4fee\u5fa9 MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 12587 &#8211; BackgroundOperationInProgressForNamespace"},"content":{"rendered":"<h1 id=\"how-to-fix-mongodb-error-code-12587-backgroundoperationinprogressfornamespace-rlwsSlcvqr\">\u5982\u4f55\u4fee\u5fa9 MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 12587 &#8211; BackgroundOperationInProgressForNamespace<\/h1>\n<p>MongoDB \u662f\u4e00\u500b\u6d41\u884c\u7684\u958b\u6e90 NoSQL \u6578\u64da\u5eab\uff0c\u63d0\u4f9b\u9ad8\u6027\u80fd\u3001\u53ef\u64f4\u5c55\u6027\u548c\u9748\u6d3b\u6027\u3002\u7136\u800c\uff0c\u50cf\u4efb\u4f55\u8edf\u4ef6\u4e00\u6a23\uff0c\u5b83\u53ef\u80fd\u9047\u5230\u53ef\u80fd\u5e72\u64fe\u6b63\u5e38\u904b\u4f5c\u7684\u932f\u8aa4\u3002\u5176\u4e2d\u4e00\u500b\u932f\u8aa4\u5c31\u662f MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 12587 &#8211; BackgroundOperationInProgressForNamespace\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u5011\u5c07\u63a2\u8a0e\u6b64\u932f\u8aa4\u7684\u539f\u56e0\u4e26\u63d0\u4f9b\u9010\u6b65\u89e3\u6c7a\u65b9\u6848\u4f86\u4fee\u5fa9\u5b83\u3002<\/p>\n<h2 id=\"understanding-mongodb-error-code-12587-rlwsSlcvqr\">\u7406\u89e3 MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 12587<\/h2>\n<p>MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 12587 \u767c\u751f\u5728\u7279\u5b9a\u547d\u540d\u7a7a\u9593\u5df2\u6709\u4e00\u500b\u80cc\u666f\u64cd\u4f5c\u6b63\u5728\u9032\u884c\u6642\u3002\u5728 MongoDB \u4e2d\uff0c\u547d\u540d\u7a7a\u9593\u6307\u7684\u662f\u6578\u64da\u5eab\u540d\u7a31\u548c\u96c6\u5408\u540d\u7a31\u7684\u7d44\u5408\u3002\u6b64\u932f\u8aa4\u901a\u5e38\u8868\u660e\u6307\u5b9a\u547d\u540d\u7a7a\u9593\u4e0a\u5df2\u7d93\u6709\u4e00\u500b\u80cc\u666f\u64cd\u4f5c\uff08\u4f8b\u5982\u7d22\u5f15\u69cb\u5efa\u6216\u96c6\u5408\u522a\u9664\uff09\u6b63\u5728\u904b\u884c\uff0c\u4e26\u4e14\u540c\u6642\u5617\u8a66\u5728\u540c\u4e00\u547d\u540d\u7a7a\u9593\u4e0a\u9032\u884c\u53e6\u4e00\u64cd\u4f5c\u3002<\/p>\n<h2 id=\"possible-causes-of-mongodb-error-code-12587-rlwsSlcvqr\">\u53ef\u80fd\u7684 MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 12587 \u539f\u56e0<\/h2>\n<p>\u60a8\u53ef\u80fd\u9047\u5230\u6b64\u932f\u8aa4\u7684\u5e7e\u500b\u539f\u56e0\u5305\u62ec\uff1a<\/p>\n<ul>\n<li><strong>\u4e26\u884c\u64cd\u4f5c\uff1a<\/strong>\u5982\u679c\u5728\u540c\u4e00\u547d\u540d\u7a7a\u9593\u4e0a\u540c\u6642\u9032\u884c\u591a\u500b\u64cd\u4f5c\uff0c\u53ef\u80fd\u6703\u5c0e\u81f4\u9019\u500b\u932f\u8aa4\u3002\u4f8b\u5982\uff0c\u5982\u679c\u60a8\u555f\u52d5\u4e00\u500b\u7d22\u5f15\u69cb\u5efa\uff0c\u7136\u5f8c\u5728\u7d22\u5f15\u69cb\u5efa\u5b8c\u6210\u4e4b\u524d\u5617\u8a66\u522a\u9664\u96c6\u5408\uff0cMongoDB \u5c07\u62cb\u51fa\u6b64\u932f\u8aa4\u3002<\/li>\n<li><strong>\u7db2\u7d61\u554f\u984c\uff1a<\/strong>\u5728\u80cc\u666f\u64cd\u4f5c\u9032\u884c\u671f\u9593\u4e0d\u7a69\u5b9a\u7684\u7db2\u7d61\u9023\u63a5\u6216\u4e2d\u65b7\u53ef\u80fd\u5c0e\u81f4\u932f\u8aa4\u767c\u751f\u3002<\/li>\n<li><strong>\u786c\u4ef6\u9650\u5236\uff1a<\/strong>\u786c\u4ef6\u8cc7\u6e90\u4e0d\u8db3\uff0c\u5982\u78c1\u76e4\u7a7a\u9593\u4f4e\u6216 CPU \u4f7f\u7528\u7387\u9ad8\uff0c\u4e5f\u53ef\u80fd\u89f8\u767c\u6b64\u932f\u8aa4\u3002<\/li>\n<\/ul>\n<h2 id=\"fixing-mongodb-error-code-12587-rlwsSlcvqr\">\u4fee\u5fa9 MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 12587<\/h2>\n<p>\u8981\u89e3\u6c7a MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 12587\uff0c\u8acb\u6309\u7167\u4ee5\u4e0b\u6b65\u9a5f\u64cd\u4f5c\uff1a<\/p>\n<h3 id=\"step-1-check-for-existing-background-operations-rlwsSlcvqr\">\u6b65\u9a5f 1\uff1a\u6aa2\u67e5\u73fe\u6709\u80cc\u666f\u64cd\u4f5c<\/h3>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6aa2\u67e5\u662f\u5426\u6709\u4efb\u4f55\u80cc\u666f\u64cd\u4f5c\u6b63\u5728\u904b\u884c\uff1a<\/p>\n<p><code>db.currentOp()<\/code><\/p>\n<p>\u6b64\u547d\u4ee4\u5c07\u986f\u793a\u6d3b\u52d5\u64cd\u4f5c\u7684\u5217\u8868\u3002\u67e5\u627e\u8207\u932f\u8aa4\u6d88\u606f\u4e2d\u63d0\u5230\u7684\u547d\u540d\u7a7a\u9593\u76f8\u95dc\u7684\u4efb\u4f55\u64cd\u4f5c\u3002<\/p>\n<h3 id=\"step-2-wait-for-the-background-operation-to-complete-rlwsSlcvqr\">\u6b65\u9a5f 2\uff1a\u7b49\u5f85\u80cc\u666f\u64cd\u4f5c\u5b8c\u6210<\/h3>\n<p>\u5982\u679c\u60a8\u767c\u73fe\u547d\u540d\u7a7a\u9593\u6709\u6b63\u5728\u9032\u884c\u7684\u80cc\u666f\u64cd\u4f5c\uff0c\u8acb\u7b49\u5f85\u5b83\u5011\u5b8c\u6210\u5f8c\u518d\u7e7c\u7e8c\u3002MongoDB \u4e00\u6b21\u53ea\u5141\u8a31\u5c0d\u6bcf\u500b\u547d\u540d\u7a7a\u9593\u9032\u884c\u4e00\u500b\u80cc\u666f\u64cd\u4f5c\u3002<\/p>\n<h3 id=\"step-3-retry-the-operation-rlwsSlcvqr\">\u6b65\u9a5f 3\uff1a\u91cd\u8a66\u64cd\u4f5c<\/h3>\n<p>\u80cc\u666f\u64cd\u4f5c\u5b8c\u6210\u5f8c\uff0c\u91cd\u8a66\u89f8\u767c\u932f\u8aa4\u7684\u64cd\u4f5c\u3002\u73fe\u5728\u61c9\u8a72\u53ef\u4ee5\u57f7\u884c\u800c\u4e0d\u6703\u9047\u5230\u932f\u8aa4\u3002<\/p>\n<h3 id=\"step-4-optimize-hardware-resources-rlwsSlcvqr\">\u6b65\u9a5f 4\uff1a\u512a\u5316\u786c\u4ef6\u8cc7\u6e90<\/h3>\n<p>\u5982\u679c\u60a8\u7d93\u5e38\u9047\u5230 MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 12587\uff0c\u8acb\u8003\u616e\u512a\u5316\u60a8\u7684\u786c\u4ef6\u8cc7\u6e90\u3002\u78ba\u4fdd\u60a8\u6709\u8db3\u5920\u7684\u78c1\u76e4\u7a7a\u9593\u3001\u5167\u5b58\u548c CPU \u5bb9\u91cf\u4f86\u8655\u7406\u4e26\u884c\u64cd\u4f5c\u3002<\/p>\n<h2 id=\"summary-rlwsSlcvqr\">\u6458\u8981<\/h2>\n<p>MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 12587 &#8211; BackgroundOperationInProgressForNamespace \u767c\u751f\u5728\u7279\u5b9a\u547d\u540d\u7a7a\u9593\u5df2\u6709\u80cc\u666f\u64cd\u4f5c\u6b63\u5728\u9032\u884c\u6642\u3002\u6b64\u932f\u8aa4\u53ef\u80fd\u7531\u4e26\u884c\u64cd\u4f5c\u3001\u7db2\u7d61\u554f\u984c\u6216\u786c\u4ef6\u9650\u5236\u5f15\u8d77\u3002\u4fee\u5fa9\u6b64\u932f\u8aa4\u6642\uff0c\u9700\u8981\u6aa2\u67e5\u73fe\u6709\u7684\u80cc\u666f\u64cd\u4f5c\uff0c\u7b49\u5f85\u5b83\u5011\u5b8c\u6210\uff0c\u91cd\u8a66\u64cd\u4f5c\uff0c\u4e26\u5728\u5fc5\u8981\u6642\u512a\u5316\u786c\u4ef6\u8cc7\u6e90\u3002<\/p>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u5c0b\u627e\u53ef\u9760\u4e14\u9ad8\u6027\u80fd\u7684 VPS \u6258\u7ba1\u89e3\u6c7a\u65b9\u6848\uff0c\u8acb\u8003\u616e <a href=\"https:\/\/server.hk\">Server.HK<\/a>\u3002\u900f\u904e\u6211\u5011\u7684\u9802\u7d1a VPS \u6258\u7ba1\u670d\u52d9\uff0c\u60a8\u53ef\u4ee5\u78ba\u4fdd MongoDB \u90e8\u7f72\u9806\u5229\u4e14\u9ad8\u6548\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u4fee\u5fa9 MongoDB \u932f\u8aa4\u4ee3&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-21925","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21925","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"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=21925"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21925\/revisions"}],"predecessor-version":[{"id":23403,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21925\/revisions\/23403"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=21925"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=21925"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=21925"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}