{"id":21901,"date":"2024-01-02T17:12:26","date_gmt":"2024-01-02T17:12:26","guid":{"rendered":"https:\/\/server.hk\/blog\/21901\/"},"modified":"2024-11-14T10:25:19","modified_gmt":"2024-11-14T02:25:19","slug":"how-to-fix-mongodb-error-code-321-tenantmigrationcommitted","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/21901\/","title":{"rendered":"\u5982\u4f55\u4fee\u5fa9MongoDB\u932f\u8aa4\u78bc &#8211; 321 &#8211; TenantMigrationCommitted"},"content":{"rendered":"<h1 id=\"how-to-fix-mongodb-error-code-321-tenantmigrationcommitted-SWwUVIAstt\">\u5982\u4f55\u4fee\u5fa9MongoDB\u932f\u8aa4\u78bc &#8211; 321 &#8211; TenantMigrationCommitted<\/h1>\n<p>MongoDB\u662f\u4e00\u500b\u6d41\u884c\u7684NoSQL\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\u6703\u9047\u5230\u9700\u8981\u89e3\u6c7a\u7684\u932f\u8aa4\u3002\u5176\u4e2d\u4e4b\u4e00\u4fbf\u662fMongoDB\u932f\u8aa4\u78bc &#8211; 321 &#8211; TenantMigrationCommitted\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-the-mongodb-error-code-321-tenantmigrationcommitted-SWwUVIAstt\">\u4e86\u89e3MongoDB\u932f\u8aa4\u78bc &#8211; 321 &#8211; TenantMigrationCommitted<\/h2>\n<p>MongoDB\u932f\u8aa4\u78bc &#8211; 321 &#8211; TenantMigrationCommitted\u767c\u751f\u5728\u5617\u8a66\u5c0d\u5df2\u7d93\u9077\u79fb\u7684\u79df\u6236\u6578\u64da\u5eab\u9032\u884c\u9077\u79fb\u64cd\u4f5c\u6642\u3002\u9019\u500b\u932f\u8aa4\u901a\u5e38\u767c\u751f\u5728\u591a\u79df\u6236\u74b0\u5883\u4e2d\uff0c\u6bcf\u500b\u79df\u6236\u90fd\u6709\u81ea\u5df1\u7684\u6578\u64da\u5eab\u3002\u932f\u8aa4\u6d88\u606f\u6307\u51fa\uff0c\u6307\u5b9a\u79df\u6236\u7684\u9077\u79fb\u5df2\u7d93\u88ab\u63d0\u4ea4\u3002<\/p>\n<p>\u5728\u57f7\u884c\u9077\u79fb\u6642\uff0cMongoDB\u6703\u8ffd\u8e64\u6bcf\u500b\u79df\u6236\u7684\u9077\u79fb\u72c0\u614b\u3002\u5982\u679c\u9077\u79fb\u5df2\u7d93\u63d0\u4ea4\uff0c\u5247\u610f\u5473\u8457\u5fc5\u8981\u7684\u66f4\u6539\u5df2\u7d93\u61c9\u7528\u5230\u79df\u6236\u7684\u6578\u64da\u5eab\uff0c\u9032\u4e00\u6b65\u7684\u9077\u79fb\u5617\u8a66\u662f\u4e0d\u5fc5\u8981\u7684\u3002<\/p>\n<h2 id=\"resolving-the-mongodb-error-code-321-tenantmigrationcommitted-SWwUVIAstt\">\u89e3\u6c7aMongoDB\u932f\u8aa4\u78bc &#8211; 321 &#8211; TenantMigrationCommitted<\/h2>\n<p>\u8981\u4fee\u5fa9MongoDB\u932f\u8aa4\u78bc &#8211; 321 &#8211; TenantMigrationCommitted\uff0c\u60a8\u9700\u8981\u78ba\u4fdd\u4e0d\u6703\u5617\u8a66\u9077\u79fb\u5df2\u7d93\u9077\u79fb\u7684\u79df\u6236\u6578\u64da\u5eab\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u53ef\u4ee5\u9075\u5faa\u7684\u6b65\u9a5f\uff1a<\/p>\n<h3 id=\"1-check-the-migration-status-SWwUVIAstt\">1. \u6aa2\u67e5\u9077\u79fb\u72c0\u614b<\/h3>\n<p>\u9996\u5148\uff0c\u60a8\u9700\u8981\u6aa2\u67e5\u76f8\u95dc\u79df\u6236\u6578\u64da\u5eab\u7684\u9077\u79fb\u72c0\u614b\u3002\u60a8\u53ef\u4ee5\u901a\u904e\u67e5\u8a62MongoDB\u7cfb\u7d71\u96c6\u5408\u4f86\u8ddf\u8e2a\u9077\u79fb\u4fe1\u606f\u3002\u5177\u9ad4\u7684\u96c6\u5408\u540d\u7a31\u53ef\u80fd\u56e0\u60a8\u7684MongoDB\u7248\u672c\u800c\u7570\uff0c\u4f46\u5b83\u5011\u901a\u5e38\u5728\u540d\u7a31\u4e2d\u5305\u542b\u201cmigration\u201d\u4e00\u8a5e\u3002<\/p>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u67e5\u8a62\u9077\u79fb\u72c0\u614b\uff1a<\/p>\n<p><code>db.&lt;migration_collection&gt;.find({tenantId: &lt;tenant_id&gt;})<\/code><\/p>\n<p>\u5c07&lt;migration_collection&gt;\u66ff\u63db\u70ba\u5be6\u969b\u7684\u9077\u79fb\u96c6\u5408\u540d\u7a31\uff0c\u5c07&lt;tenant_id&gt;\u66ff\u63db\u70ba\u60a8\u5617\u8a66\u9077\u79fb\u7684\u79df\u6236\u6578\u64da\u5eab\u7684ID\u3002<\/p>\n<h3 id=\"2-verify-the-migration-status-SWwUVIAstt\">2. \u9a57\u8b49\u9077\u79fb\u72c0\u614b<\/h3>\n<p>\u5982\u679c\u67e5\u8a62\u8fd4\u56de\u4e86\u4e00\u500b\u6587\u6a94\uff0c\u5247\u8868\u793a\u6307\u5b9a\u79df\u6236\u7684\u9077\u79fb\u5df2\u7d93\u63d0\u4ea4\u3002\u5728\u9019\u7a2e\u60c5\u6cc1\u4e0b\uff0c\u60a8\u61c9\u8a72\u4e0d\u518d\u5617\u8a66\u518d\u6b21\u9077\u79fb\u8a72\u6578\u64da\u5eab\u3002\u76f8\u53cd\uff0c\u60a8\u53ef\u4ee5\u57f7\u884c\u5176\u4ed6\u5fc5\u8981\u7684\u64cd\u4f5c\u6216\u8abf\u67e5\u53ef\u80fd\u5c0e\u81f4\u8a72\u932f\u8aa4\u7684\u5176\u4ed6\u554f\u984c\u3002<\/p>\n<h3 id=\"3-troubleshoot-other-possible-causes-SWwUVIAstt\">3. \u6392\u67e5\u5176\u4ed6\u53ef\u80fd\u7684\u539f\u56e0<\/h3>\n<p>\u5982\u679c\u67e5\u8a62\u672a\u8fd4\u56de\u4efb\u4f55\u6587\u6a94\uff0c\u6216\u8005\u60a8\u78ba\u5b9a\u9077\u79fb\u5c1a\u672a\u63d0\u4ea4\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u8abf\u67e5\u932f\u8aa4\u7684\u5176\u4ed6\u53ef\u80fd\u539f\u56e0\u3002\u4e00\u4e9b\u6f5b\u5728\u7684\u539f\u56e0\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>\u4e0d\u6b63\u78ba\u7684\u9077\u79fb\u914d\u7f6e<\/li>\n<li>\u7db2\u7d61\u9023\u63a5\u554f\u984c<\/li>\n<li>\u6b0a\u9650\u4e0d\u8db3<\/li>\n<li>\u8edf\u4ef6\u932f\u8aa4<\/li>\n<\/ul>\n<p>\u6aa2\u67e5\u60a8\u7684\u9077\u79fb\u914d\u7f6e\uff0c\u78ba\u4fdd\u60a8\u7684\u7db2\u7d61\u6b63\u5e38\u904b\u884c\uff0c\u9a57\u8b49\u60a8\u662f\u5426\u5177\u6709\u5fc5\u8981\u7684\u6b0a\u9650\uff0c\u4e26\u8003\u616e\u66f4\u65b0MongoDB\u5230\u6700\u65b0\u7248\u672c\u4ee5\u4fee\u88dc\u4efb\u4f55\u5df2\u77e5\u932f\u8aa4\u3002<\/p>\n<h2 id=\"summary-SWwUVIAstt\">\u7e3d\u7d50<\/h2>\n<p>\u7e3d\u7d50\u4f86\u8aaa\uff0cMongoDB\u932f\u8aa4\u78bc &#8211; 321 &#8211; TenantMigrationCommitted\u767c\u751f\u5728\u5617\u8a66\u5c0d\u5df2\u7d93\u9077\u79fb\u7684\u79df\u6236\u6578\u64da\u5eab\u9032\u884c\u9077\u79fb\u64cd\u4f5c\u6642\u3002\u8981\u4fee\u5fa9\u6b64\u932f\u8aa4\uff0c\u60a8\u9700\u8981\u6aa2\u67e5\u79df\u6236\u6578\u64da\u5eab\u7684\u9077\u79fb\u72c0\u614b\uff0c\u78ba\u4fdd\u4e0d\u518d\u5617\u8a66\u518d\u6b21\u9032\u884c\u9077\u79fb\u3002\u6b64\u5916\uff0c\u9084\u9700\u6392\u67e5\u5176\u4ed6\u53ef\u80fd\u7684\u539f\u56e0\uff0c\u5982\u4e0d\u6b63\u78ba\u7684\u914d\u7f6e\u3001\u7db2\u7d61\u554f\u984c\u3001\u6b0a\u9650\u6216\u8edf\u4ef6\u932f\u8aa4\u3002<\/p>\n<p>\u5982\u679c\u60a8\u5728\u9999\u6e2f\u5c0b\u627e\u53ef\u9760\u7684VPS\u6258\u7ba1\u89e3\u6c7a\u65b9\u6848\uff0c\u8acb\u8003\u616e<a href=\"https:\/\/server.hk\">Server.HK<\/a>\u3002Server.HK\u4ee5\u9802\u5c16\u7684\u6027\u80fd\u548c\u53ef\u64f4\u5c55\u6027\uff0c\u63d0\u4f9b\u591a\u7a2e\u6258\u7ba1\u9078\u64c7\u4ee5\u6eff\u8db3\u60a8\u7684\u9700\u6c42\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u4fee\u5fa9MongoDB\u932f\u8aa4\u78bc &#038;&#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-21901","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21901","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=21901"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21901\/revisions"}],"predecessor-version":[{"id":23431,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21901\/revisions\/23431"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=21901"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=21901"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=21901"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}