{"id":27656,"date":"2024-11-24T19:47:37","date_gmt":"2024-11-24T11:47:37","guid":{"rendered":"https:\/\/fwq.ai\/blog\/?p=27656"},"modified":"2024-11-24T19:47:37","modified_gmt":"2024-11-24T11:47:37","slug":"mongodb%e7%9a%84%e5%ae%89%e8%a3%85%e5%92%8c%e5%90%af%e5%8a%a8","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/27656\/","title":{"rendered":"Mongodb\u7684\u5b89\u88c5\u548c\u542f\u52a8"},"content":{"rendered":"<p><strong>1\u3001\u5b98\u65b9\u4e0b\u8f7d\u5730\u5740\uff1a<\/strong>https:\/\/www.mongodb.com\/download-center<\/p>\n<p><strong>2\u3001\u5b98\u65b9\u5b89\u88c5\u6587\u6863\uff1a<\/strong>https:\/\/docs.mongodb.com\/manual\/tutorial\/install-mongodb-on-red-hat\/<\/p>\n<p><strong>3\u3001\u5b98\u65b9\u4f7f\u7528\u6587\u6863\uff1a<\/strong>https:\/\/docs.mongodb.com\/manual\/<\/p>\n<p><strong>4\u3001\u5b98\u65b9\u4e2d\u6587\u6587\u6863\uff1ahttp:\/\/docs.mongoing.com\/manual-zh\/index.html<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><strong>4\u3001yum\u5b89\u88c5\uff1a<\/strong><\/p>\n<pre>[mongodb-org-3.2]\r\nname=MongoDB Repository\r\nbaseurl=https:\/\/repo.mongodb.org\/yum\/redhat\/$releasever\/mongodb-org\/3.2\/x86_64\/\r\ngpgcheck=1\r\nenabled=1\r\ngpgkey=https:\/\/www.mongodb.org\/static\/pgp\/server-3.2.asc<\/pre>\n<p><strong>yum list | grep mongodb \u4e2d\u5404.rpm\u5305\u7684\u4f5c\u7528<\/strong><\/p>\n<p>#\u5305\u542b\u6240\u6709\u7684mongodb\u4e2d\u6240\u6709\u7684\u5b89\u88c5\u5305<br \/>\nmongodb-org\u00a0\u00a0 \u00a0A metapackage that will automatically install the four component packages listed below.<\/p>\n<p>#\u4ec5\u662fmongodb\u7684\u670d\u52a1\u7aef<br \/>\nmongodb-org-server\u00a0\u00a0 \u00a0Contains the mongod daemon and associated configuration and init scripts.<\/p>\n<p>#mongodb\u7684\u4f8b\u5b50<br \/>\nmongodb-org-mongos\u00a0\u00a0 \u00a0Contains the mongos daemon.<\/p>\n<p>#mongodb\u7684shell\u547d\u4ee4\u884c<br \/>\nmongodb-org-shell\u00a0\u00a0 \u00a0Contains the mongo shell.<\/p>\n<p>#mongodb\u7684\u5de5\u5177<br \/>\nmongodb-org-tools\u00a0\u00a0 \u00a0Contains the following MongoDB tools: mongoimport bsondump, mongodump, mongoexport, mongofiles, mongooplog, mongoperf, mongorestore, mongostat, and mongotop.<\/p>\n<p><strong>5\u3001\u5f00\u673a\u81ea\u52a8\u542f\u52a8<\/strong><\/p>\n<pre>chkconfig mongod on<\/pre>\n<p><strong>6\u3001mongodb\u7684\u542f\u52a8\u3001\u505c\u6b62\u3001\u91cd\u542f<\/strong><\/p>\n<pre>systemctl start mongodb\r\nsystemctl stop mongodb\r\nsystemctl restart mongodb\r\n\r\n\u4e5f\u53ef\u4ee5\u6307\u5b9a conf\u6587\u4ef6\u542f\u52a8\r\n\/usr\/bin\/mongod -f \/etc\/mongod.conf<\/pre>\n<p><strong>7\u3001\u7f16\u8bd1\u6587\u4ef6\u5b89\u88c5\u4e0e\u542f\u52a8<\/strong><\/p>\n<p>\u7f16\u5199mongod.conf\u6587\u4ef6\uff0c\u53c2\u8003\uff1aMongodb\u7684\u914d\u7f6e\u6ce8\u610f\uff1a\u521b\u5efa\u8981\u5148\u521b\u5efamongod\u7528\u6237\u7ec4\u548cmongod\u7528\u6237\uff0c\u4e3a\u542f\u52a8mongodb\u4f7f\u7528\uff0c\u56e0\u4e3a\u5982\u679c\u4f7f\u7528root\u542f\u52a8\uff0c\u90a3shell\u5de5\u5177mogo\u5c06\u65e0\u6cd5\u4f7f\u7528.<\/p>\n<pre>\uff03groupadd mongod\r\n# useradd -g mongod mongod\r\n\r\n\uff03chown -R mongod:mongod \/usr\/local\/mongod\r\n\r\n# mkdir -p \/var\/log\/mongod\r\n# chown -R mongod:mongod \/var\/log\/mongod\r\n\r\n# mkdir -p \/data\/mongod\r\n# chown -R mongod:mongod \/data\/mongod\r\n\r\n# mkdir -p \/run\/mongod\r\n# chown -R mongod:mongod \/run\/mongod\r\n\r\n\uff03\u542f\u52a8\r\n# \/usr\/local\/mongod\/bin\/mongod -f \/usr\/local\/mongod\/mongod.conf --httpinterface<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u5b98\u65b9\u4e0b\u8f7d\u5730\u5740\uff1ahttps:\/\/www.mongodb.com\/download-center 2\u3001\u5b98\u65b9\u5b89\u88c5\u6587\u6863\uff1ahttps:\/\/docs.mongodb.com\/manual\/tutorial\/install-mongodb-on-red-hat\/ 3\u3001\u5b98\u65b9\u4f7f\u7528\u6587\u6863\uff1ahttps:\/\/docs.mongodb.com\/manual\/ 4\u3001\u5b98\u65b9\u4e2d\u6587\u6587\u6863\uff1ahttp:\/\/docs.mongoing.com\/manual-zh\/index.html &nbsp; 4\u3001yum\u5b89\u88c5\uff1a [mongodb-org-3.2] name=MongoDB Repository baseurl=https:\/\/repo.mongodb.org\/yum\/redhat\/$releasever\/mongodb-org\/3.2\/x86_64\/ gpgcheck=1 enabled=1 gpgkey=https:\/\/www.mongodb.org\/static\/pgp\/server-3.2.asc yum list | grep mongodb \u4e2d\u5404.rpm\u5305\u7684\u4f5c\u7528 #\u5305\u542b\u6240\u6709\u7684mongodb\u4e2d\u6240\u6709\u7684\u5b89\u88c5\u5305 mongodb-org\u00a0\u00a0 \u00a0A metapackage that will automatically install the four component packages listed below. #\u4ec5\u662fmongodb\u7684\u670d\u52a1\u7aef mongodb-org-server\u00a0\u00a0 \u00a0Contains the mongod daemon and associated configuration and init scripts. #mongodb\u7684\u4f8b\u5b50 mongodb-org-mongos\u00a0\u00a0 \u00a0Contains the mongos daemon. #mongodb\u7684shell\u547d\u4ee4\u884c mongodb-org-shell\u00a0\u00a0 \u00a0Contains the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-27656","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27656","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=27656"}],"version-history":[{"count":1,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27656\/revisions"}],"predecessor-version":[{"id":27663,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27656\/revisions\/27663"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=27656"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=27656"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=27656"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}