{"id":5379,"date":"2024-11-14T09:26:36","date_gmt":"2024-11-14T01:26:36","guid":{"rendered":"https:\/\/fwq.ai\/blog\/5379\/"},"modified":"2024-11-14T09:26:36","modified_gmt":"2024-11-14T01:26:36","slug":"mongodb%e6%80%8e%e4%b9%88%e5%a4%87%e4%bb%bd%e6%95%b0%e6%8d%ae","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/5379\/","title":{"rendered":"mongodb\u600e\u4e48\u5907\u4efd\u6570\u636e"},"content":{"rendered":"<blockquote><p>\n  mongodb\u63d0\u4f9b\u4e86\u56db\u79cd\u5907\u4efd\u65b9\u6cd5\uff1amongodump\uff08\u7b80\u5355\u6613\u7528\uff0c\u652f\u6301\u589e\u91cf\u5907\u4efd\uff09\u3001mongorestore\uff08\u4e0emongodump\u914d\u5408\u4f7f\u7528\u65b9\u4fbf\uff0c\u652f\u6301\u589e\u91cf\u6062\u590d\uff09\u3001oplog\uff08\u652f\u6301\u70b9\u65f6\u6062\u590d\uff09\u3001\u5feb\u7167\uff08\u65b9\u4fbf\u5feb\u901f\uff09\u3002\u9009\u62e9\u5408\u9002\u7684\u5907\u4efd\u65b9\u6cd5\u5e94\u8003\u8651\u6570\u636e\u5e93\u5927\u5c0f\u3001\u8d44\u6e90\u3001\u6062\u590d\u65f6\u95f4\u76ee\u6807\u548c\u6062\u590d\u70b9\u76ee\u6807\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/28\/2024052802572184217.jpg\" class=\"aligncenter\" title=\"mongodb\u600e\u4e48\u5907\u4efd\u6570\u636e\u63d2\u56fe\" alt=\"mongodb\u600e\u4e48\u5907\u4efd\u6570\u636e\u63d2\u56fe\" \/><\/p>\n<p><strong>MongoDB \u6570\u636e\u5907\u4efd\u65b9\u6cd5<\/strong><\/p>\n<p>MongoDB \u63d0\u4f9b\u4e86\u591a\u79cd\u6570\u636e\u5907\u4efd\u65b9\u6cd5\uff0c\u4f9b\u7528\u6237\u9009\u62e9\u6700\u9002\u5408\u4ed6\u4eec\u9700\u6c42\u7684\u9009\u9879\u3002\u4ee5\u4e0b\u662f\u6700\u5e38\u89c1\u7684\u5907\u4efd\u65b9\u6cd5\uff1a<\/p>\n<p><strong>1. mongodump<\/strong><\/p>\n<ul>\n<li>mongodump \u662f MongoDB \u5185\u7f6e\u7684\u5b9e\u7528\u7a0b\u5e8f\uff0c\u7528\u4e8e\u521b\u5efa\u6587\u4ef6\u7684\u6570\u636e\u5e93\u5907\u4efd\u3002<\/li>\n<li>\u4f7f\u7528 mongodump \u53ef\u8f7b\u677e\u5907\u4efd\u6574\u4e2a\u6570\u636e\u5e93\u6216\u7279\u5b9a\u96c6\u5408\u3002<\/li>\n<li>\u5907\u4efd\u53ef\u5b58\u50a8\u5728\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u6216\u8fdc\u7a0b\u670d\u52a1\u5668\u4e0a\u3002<\/li>\n<\/ul>\n<p><strong>\u4f18\u70b9\uff1a<\/strong><\/p>\n<ul>\n<li>\u7b80\u5355\u6613\u7528<\/li>\n<li>\u652f\u6301\u589e\u91cf\u5907\u4efd<\/li>\n<\/ul>\n<p><strong>\u7f3a\u70b9\uff1a<\/strong><\/p>\n<ul>\n<li>\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u9700\u8981\u505c\u6b62\u6570\u636e\u5e93<\/li>\n<li>\u5907\u4efd\u6587\u4ef6\u53ef\u80fd\u5f88\u5927<\/li>\n<\/ul>\n<p><strong>2. mongorestore<\/strong><\/p>\n<ul>\n<li>mongorestore \u662f\u4e0e mongodump \u5bf9\u5e94\u7684\u5b9e\u7528\u7a0b\u5e8f\uff0c\u7528\u4e8e\u4ece\u6587\u4ef6\u6062\u590d\u6570\u636e\u5e93\u3002<\/li>\n<li>\u53ef\u7528\u4e8e\u8fd8\u539f\u5b8c\u6574\u7684\u6570\u636e\u5e93\u6216\u90e8\u5206\u96c6\u5408\u3002<\/li>\n<li>\u6062\u590d\u8fc7\u7a0b\u53ef\u4ee5\u5e76\u884c\u8fdb\u884c\uff0c\u4ee5\u63d0\u9ad8\u6027\u80fd\u3002<\/li>\n<\/ul>\n<p><strong>\u4f18\u70b9\uff1a<\/strong><\/p>\n<ul>\n<li>\u4e0e mongodump \u914d\u5408\u4f7f\u7528\u65b9\u4fbf<\/li>\n<li>\u652f\u6301\u589e\u91cf\u6062\u590d<\/li>\n<\/ul>\n<p><strong>\u7f3a\u70b9\uff1a<\/strong><\/p>\n<ul>\n<li>\u5728\u8fd8\u539f\u8fc7\u7a0b\u4e2d\u9700\u8981\u505c\u6b62\u6570\u636e\u5e93<\/li>\n<li>\u5907\u4efd\u6587\u4ef6\u5f88\u5927\u65f6\u53ef\u80fd\u4f1a\u5f88\u6162<\/li>\n<\/ul>\n<p><strong>3. Oplog<\/strong><\/p>\n<ul>\n<li>Oplog\uff08\u64cd\u4f5c\u65e5\u5fd7\uff09\u662f MongoDB \u4e2d\u8bb0\u5f55\u6240\u6709\u6570\u636e\u5e93\u66f4\u6539\u7684\u96c6\u5408\u3002<\/li>\n<li>\u901a\u8fc7\u5c06 oplog \u4e0e\u521d\u59cb\u5907\u4efd\u76f8\u7ed3\u5408\uff0c\u53ef\u4ee5\u521b\u5efa\u70b9\u65f6\u5907\u4efd\u3002<\/li>\n<li>\u70b9\u65f6\u5907\u4efd\u5141\u8bb8\u7528\u6237\u6062\u590d\u6570\u636e\u5e93\u5230\u7279\u5b9a\u65f6\u95f4\u70b9\u3002<\/li>\n<\/ul>\n<p><strong>\u4f18\u70b9\uff1a<\/strong><\/p>\n<ul>\n<li>\u6301\u7eed\u5907\u4efd\uff0c\u4e0d\u4f1a\u5f71\u54cd\u6027\u80fd<\/li>\n<li>\u652f\u6301\u70b9\u65f6\u6062\u590d<\/li>\n<\/ul>\n<p><strong>\u7f3a\u70b9\uff1a<\/strong><\/p>\n<ul>\n<li>\u8bbe\u7f6e\u548c\u7ba1\u7406\u8f83\u590d\u6742<\/li>\n<li>\u9700\u8981\u542f\u7528 oplog<\/li>\n<\/ul>\n<p><strong>4. \u5feb\u7167<\/strong><\/p>\n<ul>\n<li>\u5feb\u7167\u662f\u4e00\u79cd\u6587\u4ef6\u7cfb\u7edf\u7ea7\u522b\u7684\u6570\u636e\u5907\u4efd\uff0c\u5b83\u521b\u5efa\u6570\u636e\u5e93\u72b6\u6001\u7684\u51bb\u7ed3\u6620\u50cf\u3002<\/li>\n<li>\u5feb\u7167\u975e\u5e38\u5feb\u901f\uff0c\u51e0\u4e4e\u4e0d\u5f71\u54cd\u6027\u80fd\u3002<\/li>\n<li>\u5feb\u7167\u53ef\u7528\u4e8e\u5feb\u901f\u6062\u590d\u6216\u521b\u5efa\u514b\u9686\u3002<\/li>\n<\/ul>\n<p><strong>\u4f18\u70b9\uff1a<\/strong><\/p>\n<ul>\n<li>\u65b9\u4fbf\u5feb\u901f<\/li>\n<li>\u4e0d\u4f1a\u5f71\u54cd\u6027\u80fd<\/li>\n<\/ul>\n<p><strong>\u7f3a\u70b9\uff1a<\/strong><\/p>\n<ul>\n<li>\u53ef\u80fd\u9700\u8981\u7b2c\u4e09\u65b9\u5de5\u5177<\/li>\n<li>\u4e0d\u652f\u6301\u589e\u91cf\u5907\u4efd<\/li>\n<\/ul>\n<p><strong>\u9009\u62e9\u5408\u9002\u7684\u5907\u4efd\u65b9\u6cd5<\/strong><\/p>\n<p>\u9009\u62e9\u5408\u9002\u7684\u5907\u4efd\u65b9\u6cd5\u53d6\u51b3\u4e8e\u4ee5\u4e0b\u56e0\u7d20\uff1a<\/p>\n<ul>\n<li>\u6570\u636e\u5e93\u5927\u5c0f<\/li>\n<li>\u53ef\u7528\u8d44\u6e90<\/li>\n<li>\u6062\u590d\u65f6\u95f4\u76ee\u6807 (RTO)<\/li>\n<li>\u6062\u590d\u70b9\u76ee\u6807 (RPO)<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u5907\u4efd\u6570\u636e\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>mongodb\u63d0\u4f9b\u4e86\u56db\u79cd\u5907\u4efd\u65b9\u6cd5\uff1amongodump\uff08\u7b80\u5355\u6613\u7528\uff0c\u652f\u6301\u589e\u91cf\u5907\u4efd\uff09\u3001mongorestore\uff08\u4e0emongodump\u914d\u5408\u4f7f\u7528\u65b9\u4fbf\uff0c\u652f\u6301\u589e\u91cf\u6062\u590d\uff09\u3001oplog\uff08\u652f\u6301\u70b9\u65f6\u6062\u590d\uff09\u3001\u5feb\u7167\uff08\u65b9\u4fbf\u5feb\u901f\uff09\u3002\u9009\u62e9\u5408\u9002\u7684\u5907\u4efd\u65b9\u6cd5\u5e94\u8003\u8651\u6570\u636e\u5e93\u5927\u5c0f\u3001\u8d44\u6e90\u3001\u6062\u590d\u65f6\u95f4\u76ee\u6807\u548c\u6062\u590d\u70b9\u76ee\u6807\u3002 MongoDB \u6570\u636e\u5907\u4efd\u65b9\u6cd5 MongoDB \u63d0\u4f9b\u4e86\u591a\u79cd\u6570\u636e\u5907\u4efd\u65b9\u6cd5\uff0c\u4f9b\u7528\u6237\u9009\u62e9\u6700\u9002\u5408\u4ed6\u4eec\u9700\u6c42\u7684\u9009\u9879\u3002\u4ee5\u4e0b\u662f\u6700\u5e38\u89c1\u7684\u5907\u4efd\u65b9\u6cd5\uff1a 1. mongodump mongodump \u662f MongoDB \u5185\u7f6e\u7684\u5b9e\u7528\u7a0b\u5e8f\uff0c\u7528\u4e8e\u521b\u5efa\u6587\u4ef6\u7684\u6570\u636e\u5e93\u5907\u4efd\u3002 \u4f7f\u7528 mongodump \u53ef\u8f7b\u677e\u5907\u4efd\u6574\u4e2a\u6570\u636e\u5e93\u6216\u7279\u5b9a\u96c6\u5408\u3002 \u5907\u4efd\u53ef\u5b58\u50a8\u5728\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u6216\u8fdc\u7a0b\u670d\u52a1\u5668\u4e0a\u3002 \u4f18\u70b9\uff1a \u7b80\u5355\u6613\u7528 \u652f\u6301\u589e\u91cf\u5907\u4efd \u7f3a\u70b9\uff1a \u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\u9700\u8981\u505c\u6b62\u6570\u636e\u5e93 \u5907\u4efd\u6587\u4ef6\u53ef\u80fd\u5f88\u5927 2. mongorestore mongorestore \u662f\u4e0e mongodump \u5bf9\u5e94\u7684\u5b9e\u7528\u7a0b\u5e8f\uff0c\u7528\u4e8e\u4ece\u6587\u4ef6\u6062\u590d\u6570\u636e\u5e93\u3002 \u53ef\u7528\u4e8e\u8fd8\u539f\u5b8c\u6574\u7684\u6570\u636e\u5e93\u6216\u90e8\u5206\u96c6\u5408\u3002 \u6062\u590d\u8fc7\u7a0b\u53ef\u4ee5\u5e76\u884c\u8fdb\u884c\uff0c\u4ee5\u63d0\u9ad8\u6027\u80fd\u3002 \u4f18\u70b9\uff1a \u4e0e mongodump \u914d\u5408\u4f7f\u7528\u65b9\u4fbf \u652f\u6301\u589e\u91cf\u6062\u590d \u7f3a\u70b9\uff1a \u5728\u8fd8\u539f\u8fc7\u7a0b\u4e2d\u9700\u8981\u505c\u6b62\u6570\u636e\u5e93 \u5907\u4efd\u6587\u4ef6\u5f88\u5927\u65f6\u53ef\u80fd\u4f1a\u5f88\u6162 3. Oplog Oplog\uff08\u64cd\u4f5c\u65e5\u5fd7\uff09\u662f MongoDB \u4e2d\u8bb0\u5f55\u6240\u6709\u6570\u636e\u5e93\u66f4\u6539\u7684\u96c6\u5408\u3002 \u901a\u8fc7\u5c06 oplog \u4e0e\u521d\u59cb\u5907\u4efd\u76f8\u7ed3\u5408\uff0c\u53ef\u4ee5\u521b\u5efa\u70b9\u65f6\u5907\u4efd\u3002 \u70b9\u65f6\u5907\u4efd\u5141\u8bb8\u7528\u6237\u6062\u590d\u6570\u636e\u5e93\u5230\u7279\u5b9a\u65f6\u95f4\u70b9\u3002 \u4f18\u70b9\uff1a \u6301\u7eed\u5907\u4efd\uff0c\u4e0d\u4f1a\u5f71\u54cd\u6027\u80fd \u652f\u6301\u70b9\u65f6\u6062\u590d \u7f3a\u70b9\uff1a \u8bbe\u7f6e\u548c\u7ba1\u7406\u8f83\u590d\u6742 \u9700\u8981\u542f\u7528 oplog 4. \u5feb\u7167 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-5379","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5379","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=5379"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5379\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=5379"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=5379"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=5379"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}