{"id":21941,"date":"2024-01-02T17:52:23","date_gmt":"2024-01-02T17:52:23","guid":{"rendered":"https:\/\/server.hk\/blog\/21941\/"},"modified":"2024-11-14T10:24:39","modified_gmt":"2024-11-14T02:24:39","slug":"how-to-fix-mongodb-error-code-12586-backgroundoperationinprogressfordatabase-2","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/21941\/","title":{"rendered":"\u5982\u4f55\u4fee\u5fa9 MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 12586 &#8211; BackgroundOperationInProgressForDatabase"},"content":{"rendered":"<h1 id=\"how-to-fix-mongodb-error-code-12586-backgroundoperationinprogressfordatabase-kHwTVQsIFj\">\u5982\u4f55\u4fee\u5fa9 MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 12586 &#8211; BackgroundOperationInProgressForDatabase<\/h1>\n<p>MongoDB \u662f\u4e00\u500b\u53d7\u6b61\u8fce\u7684\u958b\u6e90 NoSQL \u8cc7\u6599\u5eab\u7ba1\u7406\u7cfb\u7d71\uff0c\u63d0\u4f9b\u9ad8\u6027\u80fd\u3001\u53ef\u64f4\u5c55\u6027\u548c\u9748\u6d3b\u6027\u3002\u7136\u800c\uff0c\u5c31\u50cf\u4efb\u4f55\u8edf\u4ef6\u4e00\u6a23\uff0c\u5b83\u53ef\u80fd\u9047\u5230\u53ef\u80fd\u4e2d\u65b7\u5176\u6b63\u5e38\u64cd\u4f5c\u7684\u932f\u8aa4\u3002\u5176\u4e2d\u4e00\u500b\u932f\u8aa4\u662f MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 12586 &#8211; BackgroundOperationInProgressForDatabase\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u5011\u5c07\u63a2\u8a0e\u6b64\u932f\u8aa4\u7684\u6210\u56e0\u4e26\u63d0\u4f9b\u89e3\u6c7a\u65b9\u6848\u4f86\u4fee\u6b63\u5b83\u3002<\/p>\n<h2 id=\"understanding-mongodb-error-code-12586-kHwTVQsIFj\">\u7406\u89e3 MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 12586<\/h2>\n<p>MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 12586 \u767c\u751f\u5728\u67d0\u500b\u7279\u5b9a\u8cc7\u6599\u5eab\u5df2\u7d93\u6709\u80cc\u666f\u64cd\u4f5c\u6b63\u5728\u9032\u884c\u6642\u3002\u6b64\u932f\u8aa4\u901a\u5e38\u5728\u5617\u8a66\u57f7\u884c\u67d0\u4e9b\u7ba1\u7406\u4efb\u52d9\u6642\u51fa\u73fe\uff0c\u4f8b\u5982\u5275\u5efa\u6216\u522a\u9664\u96c6\u5408\u3001\u7d22\u5f15\u5275\u5efa\u6216\u8cc7\u6599\u5eab\u5099\u4efd\u3002\u932f\u8aa4\u8a0a\u606f\u53ef\u80fd\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p><code>BackgroundOperationInProgressForDatabase: A background operation is currently running for the database.<\/code><\/p>\n<p>\u9019\u500b\u932f\u8aa4\u8868\u660e MongoDB \u5df2\u7d93\u5728\u6307\u5b9a\u7684\u8cc7\u6599\u5eab\u57f7\u884c\u80cc\u666f\u64cd\u4f5c\uff0c\u5b83\u963b\u6b62\u4e86\u4efb\u4f55\u540c\u6642\u9032\u884c\u7684\u7ba1\u7406\u64cd\u4f5c\u3002<\/p>\n<h2 id=\"possible-causes-of-mongodb-error-code-12586-kHwTVQsIFj\">\u53ef\u80fd\u5c0e\u81f4 MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 12586 \u7684\u539f\u56e0<\/h2>\n<p>\u4f60\u53ef\u80fd\u9047\u5230\u6b64\u932f\u8aa4\u7684\u5e7e\u500b\u539f\u56e0\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li><strong>\u9577\u6642\u9593\u904b\u884c\u7684\u64cd\u4f5c\uff1a<\/strong>\u5982\u679c\u6709\u9577\u6642\u9593\u904b\u884c\u7684\u64cd\u4f5c\uff0c\u4f8b\u5982\u7d22\u5f15\u69cb\u5efa\u6216\u5927\u6578\u64da\u9077\u79fb\uff0cMongoDB \u53ef\u80fd\u4ecd\u5728\u80cc\u666f\u4e2d\u8655\u7406\u5b83\u5011\uff0c\u5f9e\u800c\u5c0e\u81f4\u932f\u8aa4\u3002<\/li>\n<li><strong>\u4e26\u767c\u554f\u984c\uff1a<\/strong>\u5982\u679c\u5728\u540c\u4e00\u8cc7\u6599\u5eab\u4e0a\u540c\u6642\u57f7\u884c\u591a\u500b\u7ba1\u7406\u64cd\u4f5c\uff0cMongoDB \u53ef\u80fd\u6703\u9047\u5230\u885d\u7a81\u4e26\u89f8\u767c\u932f\u8aa4\u3002<\/li>\n<li><strong>\u786c\u4ef6\u9650\u5236\uff1a<\/strong>\u7cfb\u7d71\u8cc7\u6e90\u4e0d\u8db3\uff0c\u4f8b\u5982 CPU\u3001\u8a18\u61b6\u9ad4\u6216\u78c1\u789f\u7a7a\u9593\u4e0d\u8db3\uff0c\u53ef\u5c0e\u81f4\u80cc\u666f\u64cd\u4f5c\u9700\u8981\u66f4\u9577\u6642\u9593\u5b8c\u6210\uff0c\u5f9e\u800c\u7522\u751f\u932f\u8aa4\u3002<\/li>\n<\/ul>\n<h2 id=\"fixing-mongodb-error-code-12586-kHwTVQsIFj\">\u4fee\u5fa9 MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 12586<\/h2>\n<p>\u8981\u89e3\u6c7a MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 12586\uff0c\u4f60\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9a5f\u64cd\u4f5c\uff1a<\/p>\n<h3 id=\"1-check-for-long-running-operations-kHwTVQsIFj\">1. \u6aa2\u67e5\u9577\u6642\u9593\u904b\u884c\u7684\u64cd\u4f5c<\/h3>\n<p>\u4f7f\u7528 MongoDB \u547d\u4ee4\u884c\u4ecb\u9762\u6216\u5982 MongoDB Compass \u7684 GUI \u5de5\u5177\u6aa2\u67e5\u662f\u5426\u6709\u4efb\u4f55\u6b63\u5728\u9032\u884c\u7684\u9577\u6642\u9593\u904b\u884c\u7684\u64cd\u4f5c\u3002\u67e5\u627e\u53ef\u80fd\u5c0e\u81f4\u932f\u8aa4\u7684\u64cd\u4f5c\uff0c\u5982\u7d22\u5f15\u69cb\u5efa\u6216\u6578\u64da\u9077\u79fb\u3002\u5982\u679c\u4f60\u627e\u5230\u4efb\u4f55\uff0c\u8acb\u7b49\u5f85\u5b83\u5011\u5b8c\u6210\u4e4b\u5f8c\u518d\u5617\u8a66\u518d\u6b21\u9032\u884c\u7ba1\u7406\u4efb\u52d9\u3002<\/p>\n<h3 id=\"2-ensure-sequential-execution-of-administrative-operations-kHwTVQsIFj\">2. \u78ba\u4fdd\u7ba1\u7406\u64cd\u4f5c\u7684\u9806\u5e8f\u57f7\u884c<\/h3>\n<p>\u5982\u679c\u4f60\u5728\u540c\u4e00\u8cc7\u6599\u5eab\u4e0a\u57f7\u884c\u591a\u500b\u7ba1\u7406\u64cd\u4f5c\uff0c\u78ba\u4fdd\u5b83\u5011\u662f\u4f9d\u6b21\u57f7\u884c\u800c\u4e0d\u662f\u540c\u6642\u9032\u884c\u7684\u3002\u9019\u53ef\u4ee5\u5e6b\u52a9\u907f\u514d\u885d\u7a81\u4e26\u9632\u6b62 MongoDB \u9047\u5230\u932f\u8aa4\u3002<\/p>\n<h3 id=\"3-increase-system-resources-kHwTVQsIFj\">3. \u589e\u52a0\u7cfb\u7d71\u8cc7\u6e90<\/h3>\n<p>\u5982\u679c\u4f60\u7684\u7cfb\u7d71\u8cc7\u6e90\u4e0d\u8db3\uff0c\u8003\u616e\u589e\u52a0\u53ef\u7528\u7684 CPU\u3001\u8a18\u61b6\u9ad4\u6216\u78c1\u789f\u7a7a\u9593\u3002\u9019\u53ef\u4ee5\u5e6b\u52a9\u52a0\u5feb\u80cc\u666f\u64cd\u4f5c\u4e26\u6e1b\u5c11\u9047\u5230\u932f\u8aa4\u7684\u6a5f\u6703\u3002<\/p>\n<h3 id=\"4-restart-mongodb-kHwTVQsIFj\">4. \u91cd\u555f MongoDB<\/h3>\n<p>\u5982\u679c\u5225\u7684\u624b\u6bb5\u90fd\u7121\u6548\uff0c\u91cd\u555f MongoDB \u5f80\u5f80\u53ef\u4ee5\u89e3\u6c7a\u932f\u8aa4\u3002\u4f46\u662f\uff0c\u78ba\u4fdd\u9075\u5faa\u9069\u7576\u7684\u95dc\u6a5f\u7a0b\u5e8f\uff0c\u4ee5\u907f\u514d\u6578\u64da\u640d\u58de\u6216\u4e1f\u5931\u3002<\/p>\n<h2 id=\"summary-kHwTVQsIFj\">\u7e3d\u7d50<\/h2>\n<p>MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 12586 &#8211; BackgroundOperationInProgressForDatabase \u53ef\u80fd\u767c\u751f\u5728 MongoDB \u5df2\u7d93\u5728\u6307\u5b9a\u7684\u8cc7\u6599\u5eab\u57f7\u884c\u80cc\u666f\u64cd\u4f5c\u6642\u3002\u6b64\u932f\u8aa4\u53ef\u80fd\u7531\u9577\u6642\u9593\u64cd\u4f5c\u3001\u4e26\u767c\u554f\u984c\u6216\u786c\u4ef6\u9650\u5236\u6240\u5c0e\u81f4\u3002\u8981\u4fee\u5fa9\u6b64\u932f\u8aa4\uff0c\u6aa2\u67e5\u6b63\u5728\u9032\u884c\u7684\u64cd\u4f5c\uff0c\u78ba\u4fdd\u7ba1\u7406\u4efb\u52d9\u7684\u9806\u5e8f\u57f7\u884c\uff0c\u5982\u6709\u9700\u8981\u589e\u52a0\u7cfb\u7d71\u8cc7\u6e90\uff0c\u4e26\u628a\u91cd\u555f MongoDB \u4f5c\u70ba\u6700\u5f8c\u624b\u6bb5\u8003\u616e\u3002<\/p>\n<p>\u5982\u679c\u4f60\u6b63\u5728\u7d93\u6b77 MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 12586 \u6216\u5176\u4ed6 MongoDB \u76f8\u95dc\u554f\u984c\uff0cServer.HK \u63d0\u4f9b\u53ef\u9760\u4e14\u6027\u80fd\u512a\u7570\u7684 VPS \u4e3b\u6a5f\u89e3\u6c7a\u65b9\u6848\u3002\u6211\u5011\u7684<a href=\"https:\/\/server.hk\">\u9999\u6e2f VPS \u4e3b\u6a5f<\/a>\u670d\u52d9\u63d0\u4f9b\u904b\u884c MongoDB \u53ca\u5176\u4ed6\u61c9\u7528\u7684\u7406\u60f3\u74b0\u5883\u3002\u7acb\u5373\u806f\u7e6b\u6211\u5011\uff0c\u4e86\u89e3\u66f4\u591a\u95dc\u65bc\u6211\u5011\u7684\u670d\u52d9\u53ca\u5982\u4f55\u5e6b\u52a9\u4f60\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-21941","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21941","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=21941"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21941\/revisions"}],"predecessor-version":[{"id":23382,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21941\/revisions\/23382"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=21941"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=21941"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=21941"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}