{"id":21692,"date":"2024-01-02T13:43:29","date_gmt":"2024-01-02T13:43:29","guid":{"rendered":"https:\/\/server.hk\/blog\/21692\/"},"modified":"2024-11-14T10:28:33","modified_gmt":"2024-11-14T02:28:33","slug":"how-to-fix-mongodb-error-code-102-incompatibleauditmetadata","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/21692\/","title":{"rendered":"\u5982\u4f55\u4fee\u5fa9 MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 102 &#8211; IncompatibleAuditMetadata"},"content":{"rendered":"<h1 id=\"how-to-fix-mongodb-error-code-102-incompatibleauditmetadata-dGJftTCnsR\">\u5982\u4f55\u4fee\u5fa9 MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 102 &#8211; IncompatibleAuditMetadata<\/h1>\n<p>MongoDB \u662f\u4e00\u6b3e\u5ee3\u53d7\u6b61\u8fce\u7684\u958b\u6e90 NoSQL \u6578\u64da\u5eab\uff0c\u63d0\u4f9b\u9ad8\u6548\u80fd\u3001\u53ef\u64f4\u5c55\u6027\u53ca\u9748\u6d3b\u6027\u3002\u7136\u800c\uff0c\u8207\u4efb\u4f55\u8edf\u4ef6\u4e00\u6a23\uff0c\u5b83\u4e5f\u53ef\u80fd\u906d\u9047\u9700\u8981\u89e3\u6c7a\u7684\u932f\u8aa4\u8207\u554f\u984c\u3002\u5176\u4e2d\u4e00\u500b\u932f\u8aa4\u4fbf\u662f MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 102 &#8211; IncompatibleAuditMetadata\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u5011\u5c07\u63a2\u8a0e\u6b64\u932f\u8aa4\u7684\u6210\u56e0\uff0c\u4e26\u63d0\u4f9b\u4e00\u6b65\u6b65\u7684\u89e3\u6c7a\u6307\u5f15\u3002<\/p>\n<h2 id=\"understanding-mongodb-error-code-102-incompatibleauditmetadata-dGJftTCnsR\">\u7406\u89e3 MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 102 &#8211; IncompatibleAuditMetadata<\/h2>\n<p>\u7576\u6578\u64da\u5eab\u4e2d\u7684\u5be9\u8a08\u5143\u6578\u64da\u8207\u9810\u671f\u683c\u5f0f\u4e0d\u7b26\u6642\uff0c\u5c07\u6703\u767c\u751f MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 102 &#8211; IncompatibleAuditMetadata\u3002\u6b64\u932f\u8aa4\u901a\u5e38\u5728\u60a8\u5c07 MongoDB \u5347\u7d1a\u81f3\u4e00\u500b\u5c0d\u5be9\u8a08\u5143\u6578\u64da\u7d50\u69cb\u505a\u51fa\u66f4\u6539\u7684\u65b0\u7248\u672c\u6642\u51fa\u73fe\u3002<\/p>\n<p>MongoDB \u4e2d\u7684\u5be9\u8a08\u5143\u6578\u64da\u7528\u65bc\u8ddf\u8e2a\u548c\u8a18\u9304\u5c0d\u6578\u64da\u5eab\u9032\u884c\u7684\u5404\u7a2e\u64cd\u4f5c\uff0c\u6709\u52a9\u65bc\u76e3\u63a7\u53ca\u78ba\u4fdd\u7cfb\u7d71\u7684\u5b89\u5168\u6027\u3002\u7576\u5be9\u8a08\u5143\u6578\u64da\u8b8a\u5f97\u4e0d\u517c\u5bb9\u6642\uff0cMongoDB \u4fbf\u6703\u89f8\u767c\u932f\u8aa4\u4ee3\u78bc &#8211; 102\u3002<\/p>\n<h2 id=\"fixing-mongodb-error-code-102-incompatibleauditmetadata-dGJftTCnsR\">\u4fee\u5fa9 MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 102 &#8211; IncompatibleAuditMetadata<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4fee\u5fa9 MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 102 &#8211; IncompatibleAuditMetadata \u7684\u6b65\u9a5f\uff1a<\/p>\n<h3 id=\"step-1-identify-the-affected-mongodb-instance-dGJftTCnsR\">\u6b65\u9a5f 1\uff1a\u78ba\u5b9a\u53d7\u5f71\u97ff\u7684 MongoDB \u5be6\u4f8b<\/h3>\n<p>\u9996\u5148\uff0c\u60a8\u9700\u8981\u8b58\u5225\u51fa\u6b63\u906d\u9047 IncompatibleAuditMetadata \u932f\u8aa4\u7684 MongoDB \u5be6\u4f8b\u3002\u6aa2\u67e5 MongoDB \u65e5\u8a8c\u6216\u4efb\u4f55\u932f\u8aa4\u8a0a\u606f\uff0c\u4ee5\u78ba\u5b9a\u53d7\u5f71\u97ff\u7684\u5be6\u4f8b\u3002<\/p>\n<h3 id=\"step-2-backup-the-database-dGJftTCnsR\">\u6b65\u9a5f 2\uff1a\u5099\u4efd\u6578\u64da\u5eab<\/h3>\n<p>\u5728\u9032\u884c\u4efb\u4f55\u66f4\u6539\u4e4b\u524d\uff0c\u52d9\u5fc5\u5099\u4efd\u6578\u64da\u5eab\uff0c\u4ee5\u9632\u8cc7\u6599\u55aa\u5931\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528 MongoDB \u5099\u4efd\u5de5\u5177\u6216\u624b\u52d5\u5275\u5efa\u6578\u64da\u5eab\u6587\u4ef6\u7684\u526f\u672c\u3002<\/p>\n<h3 id=\"step-3-upgrade-mongodb-dGJftTCnsR\">\u6b65\u9a5f 3\uff1a\u5347\u7d1a MongoDB<\/h3>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u4f7f\u7528\u820a\u7248\u672c\u7684 MongoDB\uff0c\u8003\u616e\u5347\u7d1a\u81f3\u6700\u65b0\u7684\u7a69\u5b9a\u7248\u672c\u3002\u5347\u7d1a MongoDB \u901a\u5e38\u80fd\u89e3\u6c7a\u517c\u5bb9\u6027\u554f\u984c\u4e26\u63d0\u4f9b\u932f\u8aa4\u4fee\u5fa9\u3002\u8acb\u6839\u64da\u60a8\u7576\u524d\u7248\u672c\u7684\u8a73\u7d30\u5347\u7d1a\u904e\u7a0b\u53c3\u95b1 MongoDB \u6587\u6a94\u3002<\/p>\n<h3 id=\"step-4-update-audit-metadata-dGJftTCnsR\">\u6b65\u9a5f 4\uff1a\u66f4\u65b0\u5be9\u8a08\u5143\u6578\u64da<\/h3>\n<p>\u5347\u7d1a MongoDB \u5f8c\uff0c\u60a8\u9700\u8981\u66f4\u65b0\u5be9\u8a08\u5143\u6578\u64da\u4ee5\u7b26\u5408\u65b0\u683c\u5f0f\u3002MongoDB \u63d0\u4f9b\u4e86\u4e00\u500b\u540d\u70ba &#8220;mongodump&#8221; \u7684\u5de5\u5177\uff0c\u53ef\u5c07\u820a\u6578\u64da\u5eab\u7684\u5be9\u8a08\u5143\u6578\u64da\u5c0e\u51fa\u3002<\/p>\n<p>\u904b\u884c\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u5c0e\u51fa\u5be9\u8a08\u5143\u6578\u64da\uff1a<\/p>\n<p><code>mongodump --dbpath \/path\/to\/old\/database --collection=system.profile --out \/path\/to\/dump\/folder<\/code><\/p>\n<p>\u5c07 &#8220;\/path\/to\/old\/database&#8221; \u66ff\u63db\u70ba\u60a8\u7684\u820a MongoDB \u6578\u64da\u5eab\u7684\u8def\u5f91\uff0c\u4e26\u5c07 &#8220;\/path\/to\/dump\/folder&#8221; \u66ff\u63db\u70ba\u60a8\u5e0c\u671b\u5132\u5b58\u5c0e\u51fa\u6578\u64da\u7684\u76ee\u9304\u3002<\/p>\n<h3 id=\"step-5-import-audit-metadata-dGJftTCnsR\">\u6b65\u9a5f 5\uff1a\u5c0e\u5165\u5be9\u8a08\u5143\u6578\u64da<\/h3>\n<p>\u4e00\u65e6\u60a8\u5c0e\u51fa\u4e86\u5be9\u8a08\u5143\u6578\u64da\uff0c\u5c31\u53ef\u4ee5\u5c07\u5176\u5c0e\u5165\u5347\u7d1a\u540e\u7684 MongoDB \u5be6\u4f8b\u3002\u4f7f\u7528 &#8220;mongorestore&#8221; \u5de5\u5177\u5c0e\u5165\u5be9\u8a08\u5143\u6578\u64da\uff1a<\/p>\n<p><code>mongorestore --dbpath \/path\/to\/new\/database --collection=system.profile \/path\/to\/dump\/folder<\/code><\/p>\n<p>\u5c07 &#8220;\/path\/to\/new\/database&#8221; \u66ff\u63db\u70ba\u5347\u7d1a\u540e MongoDB \u6578\u64da\u5eab\u7684\u8def\u5f91\uff0c\u4e26\u5c07 &#8220;\/path\/to\/dump\/folder&#8221; \u66ff\u63db\u70ba\u60a8\u5c0e\u51fa\u5be9\u8a08\u5143\u6578\u64da\u7684\u76ee\u9304\u3002<\/p>\n<h3 id=\"step-6-restart-mongodb-dGJftTCnsR\">\u6b65\u9a5f 6\uff1a\u91cd\u555f MongoDB<\/h3>\n<p>\u5c0e\u5165\u5be9\u8a08\u5143\u6578\u64da\u5f8c\uff0c\u8acb\u91cd\u555f MongoDB \u4ee5\u5957\u7528\u66f4\u6539\u3002\u78ba\u4fdd\u65e5\u8a8c\u4e2d\u4e0d\u518d\u51fa\u73fe IncompatibleAuditMetadata \u932f\u8aa4\u3002<\/p>\n<h2 id=\"summary-dGJftTCnsR\">\u7e3d\u7d50<\/h2>\n<p>\u7e3d\u800c\u8a00\u4e4b\uff0cMongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 102 &#8211; IncompatibleAuditMetadata \u767c\u751f\u5728\u6578\u64da\u5eab\u4e2d\u7684\u5be9\u8a08\u5143\u6578\u64da\u8207\u9810\u671f\u683c\u5f0f\u4e0d\u7b26\u7684\u60c5\u6cc1\u4e0b\u3002\u70ba\u4e86\u89e3\u6c7a\u6b64\u932f\u8aa4\uff1a<\/p>\n<ol>\n<li>\u8b58\u5225\u53d7\u5f71\u97ff\u7684 MongoDB \u5be6\u4f8b\u3002<\/li>\n<li>\u5099\u4efd\u6578\u64da\u5eab\u3002<\/li>\n<li>\u5c07 MongoDB \u5347\u7d1a\u81f3\u6700\u65b0\u7248\u672c\u3002<\/li>\n<li>\u4f7f\u7528 &#8220;mongodump&#8221; \u548c &#8220;mongorestore&#8221; \u5de5\u5177\u66f4\u65b0\u5be9\u8a08\u5143\u6578\u64da\u3002<\/li>\n<li>\u91cd\u555f MongoDB\u3002<\/li>\n<\/ol>\n<p>\u5982\u679c\u60a8\u9047\u5230 MongoDB \u932f\u8aa4\u4ee3\u78bc &#8211; 102 &#8211; IncompatibleAuditMetadata\uff0c\u9075\u5faa\u9019\u4e9b\u6b65\u9a5f\u61c9\u80fd\u5e6b\u52a9\u89e3\u6c7a\u554f\u984c\uff0c\u78ba\u4fdd\u60a8\u7684 MongoDB \u6578\u64da\u5eab\u5e73\u7a69\u904b\u884c\u3002<\/p>\n<p>\u5982\u9700\u7372\u53d6\u6709\u95dc VPS \u4e3b\u6a5f\u89e3\u6c7a\u65b9\u6848\u7684\u66f4\u591a\u8cc7\u8a0a\uff0c\u8acb\u8a2a\u554f <a href=\"https:\/\/server.hk\">Server.HK<\/a>\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":[4925],"tags":[],"class_list":["post-21692","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21692","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=21692"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21692\/revisions"}],"predecessor-version":[{"id":23711,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21692\/revisions\/23711"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=21692"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=21692"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=21692"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}