\u901a\u5e38MongoDB\u901a\u8fc7mongod\u7528\u6237\u8d26\u53f7\u548c\u4f7f\u7528\u8fd9\u4e9b\u9ed8\u8ba4\u76ee\u5f55<\/p>\n
\/var\/lib\/mongo (\u6570\u636e)\r\n\r\n\/var\/log\/mongodb (\u65e5\u5fd7)\r\n<\/pre>\n\u5982\u679c\u4f60\u901a\u8fc7package\u5b89\u88c5<\/p>\n
\u9ed8\u8ba4\u76ee\u5f55\u4f1a\u88ab\u521b\u5efa\uff0c\u540c\u65f6\u8fd9\u4e2a\u76ee\u5f55\u7684\u6240\u6709\u4eba\u548c\u7ec4\u7ec7\u4f1a\u88ab\u8bbe\u7f6e\u4e3amongod<\/p>\n
\u5982\u679c\u4f60\u901a\u8fc7\u538b\u7f29\u5305\u4e0b\u8f7d<\/p>\n
\u9ed8\u8ba4\u76ee\u5f55\u9700\u8981\u624b\u52a8\u521b\u5efa<\/p>\n
\u63d0\u793a\uff1a\u53d6\u51b3\u4f60\u7684\u7528\u6237\u6743\u9650\uff0c\u4e5f\u8bb8\u9700\u8981\u4f7f\u7528\u8d85\u7ea7\u6743\u9650\u6765\u8fdb\u884c\u8fd9\u4e9b\u64cd\u4f5c<\/p>\n
mkdir -p \/var\/lib\/mongo\r\n\r\nmkdir -p \/var\/log\/mongodb\r\n<\/pre>\n\u9ed8\u8ba4MongoDB\u8fd0\u884c\u4f7f\u7528mongod\u7528\u6237\u8d26\u53f7\u3002\u4e00\u6b21\u521b\u5efa\uff0c\u8bbe\u7f6e\u8fd9\u4e9b\u76ee\u5f55\u7684\u6240\u6709\u4eba\u548c\u7ec4\u7ec7\u4e3amongod<\/p>\n
chown -R mongod:mongod <directory><\/pre>\n\u4e0d\u4f7f\u7528\u9ed8\u8ba4\u76ee\u5f55\uff0c\u521b\u5efa\u60f3\u7528\u7684\u76ee\u5f55\uff0c\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\/etc\/mongod.conf\u7684\u76f8\u5173\u914d\u7f6e<\/p>\n
storage.dbPath to specify a new data directory path (e.g. \/some\/data\/directory)\r\n\r\nsystemLog.path to specify a new log file path (e.g. \/some\/log\/directory\/mongod.log)\r\n<\/pre>\n\u786e\u8ba4\u8fd0\u884c\u7684MongoDB\u5df2\u7ecf\u8bbf\u95ee\u4f7f\u7528\u8fd9\u4e9b\u76ee\u5f55<\/p>\n
chown -R mongod:mongod <directory><\/pre>\n\u542f\u52a8\u6b65\u9aa4<\/strong><\/span><\/div>\n1\u3001\u5f00\u542fMongoDB<\/p>\n
\u4f7f\u7528\u547d\u4ee4\u542f\u52a8MongoDB<\/p>\n
sudo service mongod start<\/p>\n
\u68c0\u6d4bMongoDB\u662f\u5426\u5df2\u542f\u52a8\u6210\u529f<\/p>\n
\u68c0\u6d4b\u65e5\u5fd7\u5185\u5bb9 \/var\/log\/mongodb\/mongod.log<\/p>\n
[initandlisten] waiting for connections on port <port><\/pre>\nport\u9ed8\u8ba4\u914d\u7f6e27017\uff0c\u914d\u7f6e\u4f4d\u7f6e \/etc\/mongod.conf<\/p>\n
\u4f60\u53ef\u4ee5\u786e\u8ba4MongoDB\u4f1a\u8ddf\u8e2areboot\u7cfb\u7edf\u901a\u8fc7\u8ddf\u8e2a\u547d\u4ee4<\/p>\n
sudo chkconfig mongod on<\/pre>\n2\u3001\u505c\u6b62MongoDB<\/p>\n
sudo service mongod stop<\/pre>\n3\u3001\u91cd\u542fMongoDB<\/p>\n
sudo service mongod restart<\/pre>\n4\u3001\u5f00\u59cb\u4f7f\u7528MongoDB<\/p>\n
\u5728\u540c\u4e00\u4e2a\u4e3b\u673a\u6253\u5f00\u4e00\u4e2amongo shell\u3002\u4f60\u53ef\u4ee5\u5728\u6ca1\u6709\u4efb\u4f55\u547d\u4ee4\u884c\u9009\u9879\u7684\u60c5\u51b5\u4e0b\u8fd0\u884cmongo shell\u6765\u8fde\u63a5\u5230\u60a8\u672c\u5730\u5177\u6709\u9ed8\u8ba4\u7aef\u53e327017\u7684mongod\u5b9e\u4f8b\u3002<\/p>\n
5\u3001\u5378\u8f7dMongoDB<\/p>\n
\u5378\u8f7d\u4f1a\u6e05\u9664\u6570\u636e\uff0c\u5378\u8f7d\u524d\u8bf7\u5148\u786e\u8ba4<\/p>\n
\uff081\uff09\u505c\u6b62 MongoDB<\/p>\n
sudo service mongod stop<\/pre>\n\uff082\uff09\u79fb\u9664\u5305<\/p>\n
sudo yum erase $(rpm -qa | grep mongodb-org)<\/pre>\n\uff083\uff09\u79fb\u9664\u6570\u636e\u76ee\u5f55<\/p>\n
sudo rm -r \/var\/log\/mongodb\r\n\r\nsudo rm -r \/var\/lib\/mongo\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"\u5b89\u88c5\u6b65\u9aa4 1\u3001\u914d\u7f6eyum \u521b\u5efa\u6587\u4ef6 \/etc\/yum.repos.d\/mongodb-org-4.0.repo […]<\/p>\n","protected":false},"author":362,"featured_media":149896,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-149887","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/149887","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/362"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=149887"}],"version-history":[{"count":12,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/149887\/revisions"}],"predecessor-version":[{"id":150315,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/149887\/revisions\/150315"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/149896"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=149887"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=149887"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=149887"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}