{"id":21851,"date":"2024-01-02T16:22:26","date_gmt":"2024-01-02T16:22:26","guid":{"rendered":"https:\/\/server.hk\/blog\/21851\/"},"modified":"2024-11-14T10:26:05","modified_gmt":"2024-11-14T02:26:05","slug":"how-to-fix-mongodb-error-code-269-datamodifiedbyrepair","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/21851\/","title":{"rendered":"\u5982\u4f55\u4fee\u5fa9 MongoDB \u932f\u8aa4\u78bc &#8211; 269 &#8211; DataModifiedByRepair"},"content":{"rendered":"<h1 id=\"how-to-fix-mongodb-error-code-269-datamodifiedbyrepair-qaWXeWoaCO\">\u5982\u4f55\u4fee\u5fa9 MongoDB \u932f\u8aa4\u78bc &#8211; 269 &#8211; DataModifiedByRepair<\/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\u6240\u6709\u8edf\u4ef6\u4e00\u6a23\uff0c\u5b83\u4e5f\u53ef\u80fd\u9047\u5230\u9700\u8981\u89e3\u6c7a\u7684\u932f\u8aa4\u3002\u5176\u4e2d\u4e00\u500b\u932f\u8aa4\u662f MongoDB \u932f\u8aa4\u78bc &#8211; 269 &#8211; DataModifiedByRepair\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u5011\u5c07\u63a2\u8a0e\u9019\u500b\u932f\u8aa4\u7684\u542b\u7fa9\u4ee5\u53ca\u5982\u4f55\u4fee\u5fa9\u5b83\u3002<\/p>\n<h2 id=\"understanding-mongodb-error-code-269-qaWXeWoaCO\">\u7406\u89e3 MongoDB \u932f\u8aa4\u78bc &#8211; 269<\/h2>\n<p>\u7576\u4fee\u5fa9\u64cd\u4f5c\u6b63\u5728\u4fee\u6539\u7684\u6578\u64da\u5728\u4fee\u5fa9\u5b8c\u6210\u4e4b\u524d\u518d\u6b21\u88ab\u4fee\u6539\u6642\uff0c\u5c31\u6703\u51fa\u73fe MongoDB \u932f\u8aa4\u78bc &#8211; 269\u3002\u9019\u500b\u932f\u8aa4\u901a\u5e38\u767c\u751f\u5728\u6b63\u5728\u9032\u884c\u4fee\u5fa9\u64cd\u4f5c\u7684\u6578\u64da\u4e0a\u6709\u4e26\u767c\u7684\u5beb\u5165\u64cd\u4f5c\u3002<\/p>\n<p>\u7576 MongoDB \u57f7\u884c\u4fee\u5fa9\u64cd\u4f5c\u6642\uff0c\u5b83\u6703\u9396\u5b9a\u6b63\u5728\u4fee\u5fa9\u7684\u6578\u64da\u4ee5\u78ba\u4fdd\u4e00\u81f4\u6027\u3002\u7136\u800c\uff0c\u5982\u679c\u5728\u6578\u64da\u4fee\u5fa9\u904e\u7a0b\u4e2d\u6709\u5176\u4ed6\u5beb\u5165\u64cd\u4f5c\u4fee\u6539\u4e86\u540c\u4e00\u6578\u64da\uff0cMongoDB \u5c31\u6703\u5831\u932f\u8aa4\u78bc &#8211; 269\u3002<\/p>\n<h2 id=\"fixing-mongodb-error-code-269-qaWXeWoaCO\">\u4fee\u5fa9 MongoDB \u932f\u8aa4\u78bc &#8211; 269<\/h2>\n<p>\u8981\u4fee\u5fa9 MongoDB \u932f\u8aa4\u78bc &#8211; 269\uff0c\u60a8\u53ef\u4ee5\u9075\u5faa\u4ee5\u4e0b\u6b65\u9a5f\uff1a<\/p>\n<h3 id=\"1-identify-the-affected-data-qaWXeWoaCO\">1. \u8b58\u5225\u53d7\u5f71\u97ff\u7684\u6578\u64da<\/h3>\n<p>\u9996\u5148\u8981\u505a\u7684\u662f\u8b58\u5225\u5c0e\u81f4\u932f\u8aa4\u7684\u6578\u64da\u3002\u60a8\u53ef\u4ee5\u901a\u904e\u6aa2\u67e5 MongoDB \u65e5\u8a8c\u6216\u6aa2\u67e5\u932f\u8aa4\u6d88\u606f\u4f86\u5b8c\u6210\u9019\u500b\u64cd\u4f5c\u3002\u932f\u8aa4\u6d88\u606f\u901a\u5e38\u63d0\u4f9b\u6709\u95dc\u5c0e\u81f4\u554f\u984c\u7684\u96c6\u5408\u6216\u6587\u6a94\u7684\u4fe1\u606f\u3002<\/p>\n<h3 id=\"2-stop-write-operations-qaWXeWoaCO\">2. \u505c\u6b62\u5beb\u64cd\u4f5c<\/h3>\n<p>\u4e00\u65e6\u8b58\u5225\u51fa\u53d7\u5f71\u97ff\u7684\u6578\u64da\uff0c\u60a8\u9700\u8981\u505c\u6b62\u5c0d\u8a72\u6578\u64da\u7684\u4efb\u4f55\u5beb\u64cd\u4f5c\u3002\u9019\u53ef\u4ee5\u901a\u904e\u66ab\u6642\u7981\u7528\u5c0d\u96c6\u5408\u7684\u5beb\u8a2a\u554f\u6b0a\u9650\uff0c\u6216\u8005\u66ab\u505c\u57f7\u884c\u5beb\u64cd\u4f5c\u7684\u61c9\u7528\u7a0b\u5e8f\u4f86\u5b8c\u6210\u3002<\/p>\n<h3 id=\"3-perform-the-repair-operation-qaWXeWoaCO\">3. \u57f7\u884c\u4fee\u5fa9\u64cd\u4f5c<\/h3>\n<p>\u5728\u505c\u6b62\u5beb\u64cd\u4f5c\u5f8c\uff0c\u60a8\u53ef\u4ee5\u9032\u884c\u4fee\u5fa9\u64cd\u4f5c\u3002MongoDB \u63d0\u4f9b\u4e86\u4e00\u500b\u4fee\u5fa9\u547d\u4ee4\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u5b83\u4f86\u4fee\u5fa9\u6578\u64da\u4e0d\u4e00\u81f4\u6027\u3002\u4fee\u5fa9\u547d\u4ee4\u5c07\u5206\u6790\u4e26\u4fee\u5fa9\u53d7\u5f71\u97ff\u7684\u6578\u64da\uff0c\u78ba\u4fdd\u5176\u5b8c\u6574\u6027\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u4f7f\u7528\u4fee\u5fa9\u547d\u4ee4\u7684\u793a\u4f8b\uff1a<\/p>\n<p><code>db.collection.repair()<\/code><\/p>\n<p>\u5c07 <code>collection<\/code> \u66ff\u63db\u70ba\u53d7\u5f71\u97ff\u96c6\u5408\u7684\u540d\u7a31\u3002<\/p>\n<h3 id=\"4-resume-write-operations-qaWXeWoaCO\">4. \u6062\u5fa9\u5beb\u64cd\u4f5c<\/h3>\n<p>\u4e00\u65e6\u4fee\u5fa9\u64cd\u4f5c\u5b8c\u6210\uff0c\u60a8\u53ef\u4ee5\u6062\u5fa9\u5c0d\u53d7\u5f71\u97ff\u6578\u64da\u7684\u5beb\u64cd\u4f5c\u3002\u8acb\u78ba\u4fdd\u5bc6\u5207\u76e3\u63a7\u7cfb\u7d71\uff0c\u4ee5\u78ba\u4fdd\u932f\u8aa4\u4e0d\u6703\u518d\u6b21\u767c\u751f\u3002<\/p>\n<h2 id=\"preventing-mongodb-error-code-269-qaWXeWoaCO\">\u9810\u9632 MongoDB \u932f\u8aa4\u78bc &#8211; 269<\/h2>\n<p>\u96d6\u7136\u4e0d\u4e00\u5b9a\u80fd\u5920\u7e3d\u662f\u9810\u9632 MongoDB \u932f\u8aa4\u78bc &#8211; 269\uff0c\u4f46\u60a8\u53ef\u4ee5\u9075\u5faa\u4e00\u4e9b\u6700\u4f73\u5be6\u8e10\u4f86\u6e1b\u5c11\u767c\u751f\u6b64\u932f\u8aa4\u7684\u6a5f\u6703\uff1a<\/p>\n<h3 id=\"1-use-replica-sets-qaWXeWoaCO\">1. \u4f7f\u7528\u526f\u672c\u96c6<\/h3>\n<p>MongoDB \u4e2d\u7684\u526f\u672c\u96c6\u63d0\u4f9b\u9ad8\u53ef\u7528\u6027\u548c\u81ea\u52d5\u6545\u969c\u8f49\u79fb\u3002\u901a\u904e\u4f7f\u7528\u526f\u672c\u96c6\uff0c\u60a8\u53ef\u4ee5\u5c07\u5beb\u64cd\u4f5c\u5206\u4f48\u5230\u591a\u500b\u7bc0\u9ede\u4e0a\uff0c\u964d\u4f4e\u5728\u540c\u4e00\u6578\u64da\u4e0a\u7684\u4e26\u767c\u5beb\u5165\u6a5f\u6703\u3002<\/p>\n<h3 id=\"2-implement-sharding-qaWXeWoaCO\">2. \u5be6\u65bd\u5206\u7247<\/h3>\n<p>\u5206\u7247\u5141\u8a31\u60a8\u5c07\u6578\u64da\u5206\u4f48\u5230\u591a\u500b\u670d\u52d9\u5668\u6216\u5206\u7247\u4e2d\u3002\u901a\u904e\u5c07\u6578\u64da\u5283\u5206\u70ba\u8f03\u5c0f\u7684\u584a\u4e26\u5206\u4f48\u5b83\u5011\uff0c\u60a8\u53ef\u4ee5\u6e1b\u5c11\u5728\u540c\u4e00\u6578\u64da\u4e0a\u7684\u4e26\u767c\u5beb\u5165\u6a5f\u6703\u3002<\/p>\n<h3 id=\"3-optimize-write-operations-qaWXeWoaCO\">3. \u512a\u5316\u5beb\u64cd\u4f5c<\/h3>\n<p>\u6aa2\u67e5\u61c9\u7528\u7a0b\u5e8f\u7684\u5beb\u64cd\u4f5c\u4e26\u78ba\u4fdd\u5b83\u5011\u88ab\u512a\u5316\u3002\u76e1\u91cf\u6e1b\u5c11\u4e0d\u5fc5\u8981\u7684\u5beb\u5165\u64cd\u4f5c\uff0c\u4e26\u5728\u53ef\u80fd\u7684\u60c5\u6cc1\u4e0b\u4f7f\u7528\u6279\u91cf\u5beb\u5165\u64cd\u4f5c\u4ee5\u964d\u4f4e\u4e26\u767c\u5beb\u5165\u7684\u6a5f\u6703\u3002<\/p>\n<h3 id=\"4-monitor-the-system-qaWXeWoaCO\">4. \u76e3\u63a7\u7cfb\u7d71<\/h3>\n<p>\u5b9a\u671f\u76e3\u63a7 MongoDB \u7cfb\u7d71\uff0c\u67e5\u770b\u662f\u5426\u5b58\u5728\u4efb\u4f55\u6578\u64da\u4e0d\u4e00\u81f4\u6027\u6216\u932f\u8aa4\u3002\u901a\u904e\u53ca\u65e9\u6aa2\u6e2c\u4e26\u89e3\u6c7a\u554f\u984c\uff0c\u53ef\u4ee5\u9632\u6b62\u5b83\u5011\u5347\u7d1a\u70ba\u66f4\u56b4\u91cd\u7684\u554f\u984c\u3002<\/p>\n<h2 id=\"summary-qaWXeWoaCO\">\u7e3d\u7d50<\/h2>\n<p>\u7e3d\u4e4b\uff0cMongoDB \u932f\u8aa4\u78bc &#8211; 269 &#8211; DataModifiedByRepair \u51fa\u73fe\u5728\u4fee\u5fa9\u64cd\u4f5c\u6b63\u5728\u4fee\u6539\u7684\u6578\u64da\u5728\u4fee\u5fa9\u5b8c\u6210\u4e4b\u524d\u518d\u6b21\u88ab\u4fee\u6539\u6642\u3002\u8981\u4fee\u5fa9\u6b64\u932f\u8aa4\uff0c\u60a8\u9700\u8981\u8b58\u5225\u53d7\u5f71\u97ff\u7684\u6578\u64da\uff0c\u505c\u6b62\u5beb\u64cd\u4f5c\uff0c\u9032\u884c\u4fee\u5fa9\u64cd\u4f5c\uff0c\u7136\u5f8c\u6062\u5fa9\u5beb\u64cd\u4f5c\u3002\u9075\u5faa\u4f7f\u7528\u526f\u672c\u96c6\u3001\u5be6\u65bd\u5206\u7247\u3001\u512a\u5316\u5beb\u64cd\u4f5c\u548c\u76e3\u63a7\u7cfb\u7d71\u7b49\u6700\u4f73\u5be6\u8e10\uff0c\u6709\u52a9\u65bc\u9632\u6b62\u767c\u751f\u6b64\u932f\u8aa4\u3002\u5982\u9700\u53ef\u9760\u4e14\u9ad8\u6027\u80fd\u7684 VPS \u4e3b\u6a5f\u89e3\u6c7a\u65b9\u6848\uff0c\u8acb\u8003\u616e <a href=\"https:\/\/server.hk\">Server.HK<\/a>\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u4fee\u5fa9 MongoDB \u932f\u8aa4\u78bc&#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-21851","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21851","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=21851"}],"version-history":[{"count":2,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21851\/revisions"}],"predecessor-version":[{"id":23497,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21851\/revisions\/23497"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=21851"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=21851"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=21851"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}