{"id":21798,"date":"2024-01-02T15:29:29","date_gmt":"2024-01-02T15:29:29","guid":{"rendered":"https:\/\/server.hk\/blog\/21798\/"},"modified":"2024-11-14T10:26:52","modified_gmt":"2024-11-14T02:26:52","slug":"how-to-fix-mongodb-error-code-215-databasedroppending","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/21798\/","title":{"rendered":"\u5982\u4f55\u89e3\u6c7a MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 215 &#8211; \u6578\u64da\u5eab\u522a\u9664\u5f85\u8655\u7406"},"content":{"rendered":"<h1 id=\"how-to-fix-mongodb-error-code-215-databasedroppending-rPBsNXLZDP\">\u5982\u4f55\u89e3\u6c7a MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 215 &#8211; \u6578\u64da\u5eab\u522a\u9664\u5f85\u8655\u7406<\/h1>\n<p>MongoDB \u662f\u4e00\u500b\u53d7\u6b61\u8fce\u7684\u958b\u6e90 NoSQL \u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\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\u6703\u9047\u5230\u9700\u8981\u89e3\u6c7a\u7684\u932f\u8aa4\u3002\u5176\u4e2d\u4e00\u500b\u932f\u8aa4\u5c31\u662f MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 215 &#8211; \u6578\u64da\u5eab\u522a\u9664\u5f85\u8655\u7406\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\u3002<\/p>\n<h2 id=\"understanding-mongodb-error-code-215-databasedroppending-rPBsNXLZDP\">\u7406\u89e3 MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 215 &#8211; \u6578\u64da\u5eab\u522a\u9664\u5f85\u8655\u7406<\/h2>\n<p>\u7576\u60a8\u9047\u5230 MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 215 &#8211; \u6578\u64da\u5eab\u522a\u9664\u5f85\u8655\u7406\u6642\uff0c\u9019\u610f\u5473\u8457\u60a8\u6b63\u5728\u5617\u8a66\u522a\u9664\u4e00\u500b\u7576\u524d\u6b63\u5728\u88ab\u522a\u9664\u6216\u6b63\u5728\u9032\u884c\u5176\u4ed6\u64cd\u4f5c\u7684\u6578\u64da\u5eab\u3002\u7576\u6578\u64da\u5eab\u4e0a\u6709\u6b63\u5728\u9032\u884c\u7684\u64cd\u4f5c\u6642\uff0c\u6703\u963b\u6b62\u7acb\u523b\u522a\u9664\u8a72\u6578\u64da\u5eab\u3002<\/p>\n<p>\u932f\u8aa4\u6d88\u606f\u901a\u5e38\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p><code>DatabaseDropPending: \u4e0d\u80fd\u522a\u9664\u6578\u64da\u5eab\uff0c\u56e0\u70ba\u8a72\u6578\u64da\u5eab\u76ee\u524d\u6b63\u5728\u904b\u884c\u80cc\u666f\u64cd\u4f5c\u3002<\/code><\/p>\n<h2 id=\"possible-causes-of-mongodb-error-code-215-databasedroppending-rPBsNXLZDP\">MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 215 &#8211; \u6578\u64da\u5eab\u522a\u9664\u5f85\u8655\u7406\u7684\u53ef\u80fd\u539f\u56e0<\/h2>\n<p>\u60a8\u53ef\u80fd\u9047\u5230\u6b64\u932f\u8aa4\u7684\u5e7e\u500b\u539f\u56e0\uff1a<\/p>\n<ul>\n<li><strong>\u4e26\u767c\u64cd\u4f5c\uff1a<\/strong>\u5982\u679c\u6578\u64da\u5eab\u4e0a\u6709\u4e26\u767c\u64cd\u4f5c\u6b63\u5728\u904b\u884c\uff0c\u4f8b\u5982\u63d2\u5165\u3001\u66f4\u65b0\u6216\u7d22\u5f15\u5275\u5efa\uff0cMongoDB \u5c07\u4e0d\u5141\u8a31\u60a8\u522a\u9664\u8a72\u6578\u64da\u5eab\uff0c\u76f4\u5230\u9019\u4e9b\u64cd\u4f5c\u5b8c\u6210\u3002<\/li>\n<li><strong>\u526f\u672c\u96c6\u540c\u6b65\uff1a<\/strong>\u5982\u679c\u60a8\u5728\u4f7f\u7528\u526f\u672c\u96c6\uff0c\u4e3b\u7bc0\u9ede\u548c\u5f9e\u7bc0\u9ede\u53ef\u80fd\u6b63\u5728\u540c\u6b65\u6578\u64da\u3002\u5728\u6b64\u904e\u7a0b\u4e2d\uff0c\u4e0d\u5141\u8a31\u522a\u9664\u6578\u64da\u5eab\u3002<\/li>\n<li><strong>\u9396\u5b9a\u7684\u96c6\u5408\uff1a<\/strong>\u5982\u679c\u6578\u64da\u5eab\u4e2d\u7684\u4efb\u4f55\u96c6\u5408\u56e0\u70ba\u6b63\u5728\u9032\u884c\u7684\u64cd\u4f5c\u800c\u88ab\u9396\u5b9a\uff0cMongoDB \u5c07\u9632\u6b62\u60a8\u522a\u9664\u8a72\u6578\u64da\u5eab\u3002<\/li>\n<\/ul>\n<h2 id=\"fixing-mongodb-error-code-215-databasedroppending-rPBsNXLZDP\">\u4fee\u5fa9 MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 215 &#8211; \u6578\u64da\u5eab\u522a\u9664\u5f85\u8655\u7406<\/h2>\n<p>\u8981\u89e3\u6c7a MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 215 &#8211; \u6578\u64da\u5eab\u522a\u9664\u5f85\u8655\u7406\uff0c\u8acb\u6309\u7167\u4ee5\u4e0b\u6b65\u9a5f\u64cd\u4f5c\uff1a<\/p>\n<h3 id=\"step-1-check-for-ongoing-operations-rPBsNXLZDP\">\u6b65\u9a5f 1\uff1a\u6aa2\u67e5\u6b63\u5728\u9032\u884c\u7684\u64cd\u4f5c<\/h3>\n<p>\u5728 MongoDB shell \u4e2d\u4f7f\u7528 <code>db.currentOp()<\/code> \u547d\u4ee4\u4f86\u6aa2\u67e5\u60a8\u60f3\u8981\u522a\u9664\u7684\u6578\u64da\u5eab\u4e0a\u662f\u5426\u6709\u4efb\u4f55\u6b63\u5728\u9032\u884c\u7684\u64cd\u4f5c\u3002\u67e5\u770b\u662f\u5426\u6709\u4efb\u4f55\u6d3b\u52d5\u64cd\u4f5c\u53ef\u80fd\u6703\u963b\u6b62\u8a72\u6578\u64da\u5eab\u88ab\u522a\u9664\u3002<\/p>\n<pre><code>use \r\ndb.currentOp()\r\n<\/code><\/pre>\n<p>\u5982\u679c\u60a8\u767c\u73fe\u6709\u4efb\u4f55\u6b63\u5728\u9032\u884c\u7684\u64cd\u4f5c\uff0c\u8acb\u7b49\u5b83\u5011\u5b8c\u6210\u5f8c\u518d\u9032\u5165\u4e0b\u4e00\u6b65\u3002<\/p>\n<h3 id=\"step-2-check-replica-set-syncing-rPBsNXLZDP\">\u6b65\u9a5f 2\uff1a\u6aa2\u67e5\u526f\u672c\u96c6\u540c\u6b65\u60c5\u6cc1<\/h3>\n<p>\u5982\u679c\u60a8\u5728\u4f7f\u7528\u526f\u672c\u96c6\uff0c\u8acb\u78ba\u4fdd\u4e3b\u7bc0\u9ede\u548c\u5f9e\u7bc0\u9ede\u5df2\u5b8c\u5168\u540c\u6b65\u3002\u60a8\u53ef\u4ee5\u5728 MongoDB shell \u4e2d\u4f7f\u7528 <code>rs.status()<\/code> \u547d\u4ee4\u4f86\u6aa2\u67e5\u8907\u88fd\u72c0\u614b\u3002<\/p>\n<pre><code>rs.status()\r\n<\/code><\/pre>\n<p>\u5982\u679c\u8907\u88fd\u5c1a\u5728\u9032\u884c\u4e2d\uff0c\u8acb\u7b49\u5230\u5b8c\u6210\u5f8c\u518d\u5617\u8a66\u522a\u9664\u6578\u64da\u5eab\u3002<\/p>\n<h3 id=\"step-3-unlock-locked-collections-rPBsNXLZDP\">\u6b65\u9a5f 3\uff1a\u89e3\u9396\u88ab\u9396\u5b9a\u7684\u96c6\u5408<\/h3>\n<p>\u5982\u679c\u6578\u64da\u5eab\u4e2d\u7684\u4efb\u4f55\u96c6\u5408\u56e0\u6b63\u5728\u9032\u884c\u7684\u64cd\u4f5c\u800c\u88ab\u9396\u5b9a\uff0c\u60a8\u9700\u8981\u5728\u522a\u9664\u6578\u64da\u5eab\u4e4b\u524d\u5148\u89e3\u9396\u5b83\u5011\u3002\u5728 MongoDB shell \u4e2d\u4f7f\u7528 <code>db.fsyncUnlock()<\/code> \u547d\u4ee4\u4f86\u91cb\u653e\u9396\u5b9a\u3002<\/p>\n<pre><code>use \r\ndb.fsyncLock()\r\n<\/code><\/pre>\n<p>\u5728\u57f7\u884c <code>db.fsyncLock()<\/code> \u547d\u4ee4\u5f8c\uff0c\u7b49\u5e7e\u79d2\u9418\uff0c\u7136\u5f8c\u57f7\u884c <code>db.fsyncUnlock()<\/code> \u547d\u4ee4\u4ee5\u91cb\u653e\u9396\u3002<\/p>\n<h3 id=\"step-4-drop-the-database-rPBsNXLZDP\">\u6b65\u9a5f 4\uff1a\u522a\u9664\u6578\u64da\u5eab<\/h3>\n<p>\u4e00\u65e6\u78ba\u4fdd\u6c92\u6709\u6b63\u5728\u9032\u884c\u7684\u64cd\u4f5c\uff0c\u526f\u672c\u96c6\u5df2\u5b8c\u5168\u540c\u6b65\uff0c\u4e14\u6240\u6709\u96c6\u5408\u90fd\u5df2\u89e3\u9396\uff0c\u60a8\u53ef\u4ee5\u7e7c\u7e8c\u522a\u9664\u6578\u64da\u5eab\u3002\u5728 MongoDB shell \u4e2d\u4f7f\u7528 <code>db.dropDatabase()<\/code> \u547d\u4ee4\u4f86\u522a\u9664\u6578\u64da\u5eab\u3002<\/p>\n<pre><code>use \r\ndb.dropDatabase()\r\n<\/code><\/pre>\n<p>\u5728\u57f7\u884c <code>db.dropDatabase()<\/code> \u547d\u4ee4\u5f8c\uff0c\u6578\u64da\u5eab\u5c07\u88ab\u522a\u9664\uff0cMongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 215 &#8211; \u6578\u64da\u5eab\u522a\u9664\u5f85\u8655\u7406\u61c9\u8a72\u4e0d\u6703\u518d\u767c\u751f\u3002<\/p>\n<h2 id=\"summary-rPBsNXLZDP\">\u7e3d\u7d50<\/h2>\n<p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u5011\u8a0e\u8ad6\u4e86 MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 215 &#8211; \u6578\u64da\u5eab\u522a\u9664\u5f85\u8655\u7406\uff0c\u4e26\u63d0\u4f9b\u4e86\u9010\u6b65\u7684\u4fee\u5fa9\u6307\u5c0e\u3002\u8acb\u8a18\u5f97\u6aa2\u67e5\u6b63\u5728\u9032\u884c\u7684\u64cd\u4f5c\uff0c\u78ba\u4fdd\u526f\u672c\u96c6\u540c\u6b65\u5df2\u5b8c\u6210\uff0c\u89e3\u9396\u88ab\u9396\u5b9a\u7684\u96c6\u5408\uff0c\u7136\u5f8c\u518d\u522a\u9664\u6578\u64da\u5eab\u3002\u5982\u679c\u60a8\u9047\u5230\u9032\u4e00\u6b65\u7684\u554f\u984c\u6216\u9700\u8981\u6709\u95dc MongoDB \u6216 VPS \u4e3b\u6a5f\u7684\u5354\u52a9\uff0c\u8003\u616e\u806f\u7e6b <a href=\"https:\/\/server.hk\">Server.HK<\/a> \u5c0b\u6c42\u5c08\u696d\u652f\u6301\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u89e3\u6c7a 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-21798","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21798","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=21798"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21798\/revisions"}],"predecessor-version":[{"id":23568,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21798\/revisions\/23568"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=21798"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=21798"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=21798"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}