{"id":5382,"date":"2024-11-14T08:20:03","date_gmt":"2024-11-14T00:20:03","guid":{"rendered":"https:\/\/fwq.ai\/blog\/5382\/"},"modified":"2024-11-14T08:20:03","modified_gmt":"2024-11-14T00:20:03","slug":"mongodb%e6%80%8e%e4%b9%88%e5%90%af%e5%8a%a8","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/5382\/","title":{"rendered":"mongodb\u600e\u4e48\u542f\u52a8"},"content":{"rendered":"<blockquote><p>\n  \u8981\u542f\u52a8 mongodb \u670d\u52a1\u5668\uff1a\u5728 unix \u7cfb\u7edf\u4e2d\uff0c\u8fd0\u884c mongod \u547d\u4ee4\u3002\u5728 windows \u7cfb\u7edf\u4e2d\uff0c\u8fd0\u884c mongod.exe \u547d\u4ee4\u3002\u53ef\u9009\uff1a\u4f7f\u7528 &#8211;dbpath\u3001&#8211;port\u3001&#8211;auth \u6216 &#8211;replset \u9009\u9879\u8bbe\u7f6e\u914d\u7f6e\u3002\u4f7f\u7528 mongo \u547d\u4ee4\u9a8c\u8bc1\u8fde\u63a5\u662f\u5426\u6210\u529f\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/28\/2024052803061972514.jpg\" class=\"aligncenter\" title=\"mongodb\u600e\u4e48\u542f\u52a8\u63d2\u56fe\" alt=\"mongodb\u600e\u4e48\u542f\u52a8\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u542f\u52a8 MongoDB<\/strong><\/p>\n<p>\u8981\u542f\u52a8 MongoDB \u6570\u636e\u5e93\u670d\u52a1\u5668\uff0c\u8bf7\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<p><strong>\u5728 Unix \u7cfb\u7edf\u4e0a\uff1a<\/strong><\/p>\n<ol>\n<li><strong>\u6253\u5f00\u7ec8\u7aef\u7a97\u53e3\u3002<\/strong><\/li>\n<li> <strong>\u5bfc\u822a\u5230 MongoDB \u7684\u5b89\u88c5\u76ee\u5f55\u3002<\/strong> \u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f4d\u4e8e \/usr\/local\/\/bin\u3002<\/li>\n<li><strong>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/strong><\/li>\n<\/ol>\n<pre>mongod<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u5728 Windows \u7cfb\u7edf\u4e0a\uff1a<\/strong><\/p>\n<ol>\n<li><strong>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u3002<\/strong><\/li>\n<li> <strong>\u5bfc\u822a\u5230 MongoDB \u7684\u5b89\u88c5\u76ee\u5f55\u3002<\/strong> \u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f4d\u4e8e C:Program FilesMongoDBServer.4in\u3002<\/li>\n<li><strong>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/strong><\/li>\n<\/ol>\n<pre>mongod.exe<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u8bbe\u7f6e\u9009\u9879\uff1a<\/strong><\/p>\n<p>\u60a8\u8fd8\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a\u4ee5\u4e0b\u9009\u9879\u6765\u542f\u52a8 MongoDB\uff1a<\/p>\n<ul>\n<li> <strong>&#8211;dbpath<\/strong>\uff1a\u6307\u5b9a\u6570\u636e\u76ee\u5f55\u7684\u8def\u5f84\u3002<\/li>\n<li> <strong>&#8211;port<\/strong>\uff1a\u6307\u5b9a MongoDB \u76d1\u542c\u7684\u7aef\u53e3\uff08\u9ed8\u8ba4\u4e3a 27017\uff09\u3002<\/li>\n<li> <strong>&#8211;auth<\/strong>\uff1a\u542f\u7528\u8eab\u4efd\u9a8c\u8bc1\u3002<\/li>\n<li> <strong>&#8211;replSet<\/strong>\uff1a\u521b\u5efa\u4e00\u4e2a\u590d\u5236\u96c6\u3002<\/li>\n<\/ul>\n<p><strong>\u9a8c\u8bc1\u542f\u52a8\uff1a<\/strong><\/p>\n<p>\u8981\u9a8c\u8bc1 MongoDB \u662f\u5426\u5df2\u6210\u529f\u542f\u52a8\uff0c\u8bf7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>mongo<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5982\u679c\u8fde\u63a5\u6210\u529f\uff0c\u60a8\u5c06\u770b\u5230\u4ee5\u4e0b\u63d0\u793a\uff1a<\/p>\n<pre>MongoDB shell version:\nconnecting to: mongodb:\/\/127.0.0.1:27017\nServer has startup warnings:\n&gt; 2023-04-04T17:07:38.096+08:00 I NETWORK  [initandlisten] Detected data files in \/Users\/username\/mongodb-data created by MongoDB 6.0.8, this version of MongoDB may upgrade these files to a newer format that is not compatible with version 6.0.8.\n&gt; 2023-04-04T17:07:38.096+08:00 I NETWORK  [initandlisten] Detected data files in \/Users\/username\/mongodb-data created by MongoDB 6.0.8, this version of MongoDB may upgrade these files to a newer format that is not compatible with version 6.0.8.\nPrimary: primary\n&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u542f\u52a8\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>\u8981\u542f\u52a8 mongodb \u670d\u52a1\u5668\uff1a\u5728 unix \u7cfb\u7edf\u4e2d\uff0c\u8fd0\u884c mongod \u547d\u4ee4\u3002\u5728 windows \u7cfb\u7edf\u4e2d\uff0c\u8fd0\u884c mongod.exe \u547d\u4ee4\u3002\u53ef\u9009\uff1a\u4f7f\u7528 &#8211;dbpath\u3001&#8211;port\u3001&#8211;auth \u6216 &#8211;replset \u9009\u9879\u8bbe\u7f6e\u914d\u7f6e\u3002\u4f7f\u7528 mongo \u547d\u4ee4\u9a8c\u8bc1\u8fde\u63a5\u662f\u5426\u6210\u529f\u3002 \u5982\u4f55\u542f\u52a8 MongoDB \u8981\u542f\u52a8 MongoDB \u6570\u636e\u5e93\u670d\u52a1\u5668\uff0c\u8bf7\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a \u5728 Unix \u7cfb\u7edf\u4e0a\uff1a \u6253\u5f00\u7ec8\u7aef\u7a97\u53e3\u3002 \u5bfc\u822a\u5230 MongoDB \u7684\u5b89\u88c5\u76ee\u5f55\u3002 \u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f4d\u4e8e \/usr\/local\/\/bin\u3002 \u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a mongod \u767b\u5f55\u540e\u590d\u5236 \u5728 Windows \u7cfb\u7edf\u4e0a\uff1a \u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u3002 \u5bfc\u822a\u5230 MongoDB \u7684\u5b89\u88c5\u76ee\u5f55\u3002 \u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f4d\u4e8e C:Program FilesMongoDBServer.4in\u3002 \u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a mongod.exe \u767b\u5f55\u540e\u590d\u5236 \u8bbe\u7f6e\u9009\u9879\uff1a \u60a8\u8fd8\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a\u4ee5\u4e0b\u9009\u9879\u6765\u542f\u52a8 MongoDB\uff1a &#8211;dbpath\uff1a\u6307\u5b9a\u6570\u636e\u76ee\u5f55\u7684\u8def\u5f84\u3002 &#8211;port\uff1a\u6307\u5b9a MongoDB \u76d1\u542c\u7684\u7aef\u53e3\uff08\u9ed8\u8ba4\u4e3a 27017\uff09\u3002 [&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-5382","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5382","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=5382"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5382\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=5382"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=5382"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=5382"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}