{"id":1285,"date":"2014-11-05T18:49:22","date_gmt":"2014-11-05T10:49:22","guid":{"rendered":"http:\/\/www.strongd.net\/?p=1285"},"modified":"2014-11-05T18:49:22","modified_gmt":"2014-11-05T10:49:22","slug":"mongodb%e6%95%b0%e6%8d%ae%e8%bf%81%e7%a7%bb2%e7%a7%8d%e6%96%b9%e5%bc%8f%e6%af%94%e8%be%83","status":"publish","type":"post","link":"https:\/\/www.strongd.net\/?p=1285","title":{"rendered":"mongodb\u6570\u636e\u8fc1\u79fb2\u79cd\u65b9\u5f0f\u6bd4\u8f83"},"content":{"rendered":"<p>\u5c1d\u8bd5\u4e862\u79cd\u65b9\u5f0f\u5bf9\u6570\u636e\u8fdb\u884c\u8fc1\u79fb\uff0c\u4e00\u79cd\u662frsync\uff0c\u76f4\u63a5\u62c9\u53d6\u6570\u636e\uff1b\u53e6\u4e00\u79cd\u662f\u4f7f\u7528mongodump\/mongorestore<\/p>\n<p>1.rsync<br \/>\n\u64cd\u4f5c\u6b65\u9aa4\uff1a<br \/>\n1.2\uff1a<br \/>\n[mongodb]<br \/>\npath = \/data1\/mongodb\/data<br \/>\nhosts allow = 192.168.1.0\/24<br \/>\nread only = no<br \/>\nwrite only = no<br \/>\n1.3\uff1a<br \/>\nrsync -avz root@192.168.1.2::mongodb\/dbname \/data\/mongodb-linux-x86_64-1.8.1\/data\/<br \/>\nchown -R mongodb:mongodb \/data\/mongodb-linux-x86_64-1.8.1\/data\/<\/p>\n<p>\u4f7f\u7528\u65f6\u95f4\uff1a50\u5206\u949f<br \/>\n\u5230\u76ee\u6807\u670d\u52a1\u5668\u6570\u636e\uff1a50G<br \/>\n\u4f18\u70b9\uff1a\u4f7f\u7528\u65f6\u95f4\u77ed<br \/>\n\u7f3a\u70b9\uff1a\u9700\u8981\u914d\u7f6ersync\uff0c\u6570\u636e\u5360\u7528\u7684\u7a7a\u95f4\u5927\uff08\u6570\u636e\u539f\u5c01\u4e0d\u52a8\u7684\u62c9\u53d6\u8fc7\u6765\uff0c\u5305\u62ec\u788e\u7247\uff09<\/p>\n<p>2.mongodump\/mongorestore<br \/>\n\u64cd\u4f5c\u6b65\u9aa4\uff1a<br \/>\nmongodump:<br \/>\n\/data\/PRG\/mongodb\/bin\/mongodump &#8211;host 192.168.1.2:27017 -d dbname -uuername -ppasswd -o \/data\/mongodb-linux-x86_64-1.8.1\/data\/ &#8211;directoryperdb<br \/>\nmongorestore:<br \/>\n\/data\/mongodb-linux-x86_64-1.8.1\/bin\/mongorestore &#8211;dbpath \/data\/mongodb-linux-x86_64-1.8.1\/data\/ &#8211;directoryperdb \/data\/dbname\/<br \/>\nchown -R mongodb:mongodb \/data\/mongodb-linux-x86_64-1.8.1\/data\/<\/p>\n<p>\u4f7f\u7528\u65f6\u95f4\uff1a35\uff08mongodump\uff09+90\uff08mongorestore\uff09<br \/>\n\u5230\u76ee\u6807\u670d\u52a1\u5668\u6570\u636e\uff1a20G\uff08\u9700\u8981\u7684\u7a7a\u95f4\u5927\u5927\u51cf\u5c0f\uff0c\u62c9\u53d6\u8fc7\u7a0b\u4e2d\u76f8\u5f53\u4e8e\u505a\u4e86\u4e00\u6b21\u788e\u7247\u6574\u7406\uff09<br \/>\n\u4f18\u70b9\uff1a\u8fc1\u79fb\u5230\u65b0\u670d\u52a1\u5668\u7684\u6570\u636e\u7ecf\u8fc7\u4e86\u6574\u7406\uff0c\u9700\u8981\u7a7a\u95f4\u5927\u5927\u51cf\u5c0f<br \/>\n\u7f3a\u70b9\uff1a\u9700\u8981\u65f6\u95f4\u957f<\/p>\n<p>\u6570\u636e\u8fc1\u79fb\u65f6\u9700\u8981\u505cmongo\u8fdb\u884c\u64cd\u4f5c\uff0c\u800c2\u79cd\u65b9\u5f0f\u5404\u6709\u4f18\u7f3a\u70b9\uff0c\u5982\u679c\u53ef\u4ee5\u5ffd\u7565\u64cd\u4f5c\u65f6\u95f4\u5185\u7684\u6570\u636e\u7684\u8bdd\uff0c\u90a3\u4e48\u4f7f\u7528\u7b2c2\u79cd\u65b9\u5f0f\u4f1a\u6bd4\u8f83\u597d\uff08\u5df2\u7ecf\u6709\u4e0d\u5c11\u4f8b\u5b50\u56e0\u4e3a\u788e\u7247\u5e26\u6765\u4e25\u91cd\u7684\u540e\u679c\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5c1d\u8bd5\u4e862\u79cd\u65b9\u5f0f\u5bf9\u6570\u636e\u8fdb\u884c\u8fc1\u79fb\uff0c\u4e00\u79cd\u662frsync\uff0c\u76f4\u63a5\u62c9\u53d6\u6570\u636e\uff1b\u53e6\u4e00\u79cd\u662f\u4f7f\u7528mongodump\/mongorestore 1.rsync \u64cd\u4f5c\u6b65\u9aa4\uff1a 1.2\uff1a [mongodb] path = \/data1\/mongodb\/data hosts allow = 192.168.1.0\/24 read only = no write only = no 1.3\uff1a rsync -avz root@192.168.1.2::mongodb\/dbname \/data\/mongodb-linux-x86_64-1.8.1\/data\/ chown -R mongodb:mongodb \/data\/mongodb-linux-x86_64-1.8.1\/data\/ \u4f7f\u7528\u65f6\u95f4\uff1a50\u5206\u949f \u5230\u76ee\u6807\u670d\u52a1\u5668\u6570\u636e\uff1a50G \u4f18\u70b9\uff1a\u4f7f\u7528\u65f6\u95f4\u77ed \u7f3a\u70b9\uff1a\u9700\u8981\u914d\u7f6ersync\uff0c\u6570\u636e\u5360\u7528\u7684\u7a7a\u95f4\u5927\uff08\u6570\u636e\u539f\u5c01\u4e0d\u52a8\u7684\u62c9\u53d6\u8fc7\u6765\uff0c\u5305\u62ec\u788e\u7247\uff09 2.mongodump\/mongorestore \u64cd\u4f5c\u6b65\u9aa4\uff1a mongodump: \/data\/PRG\/mongodb\/bin\/mongodump &#8211;host 192.168.1.2:27017 -d dbname -uuername -ppasswd -o \/data\/mongodb-linux-x86_64-1.8.1\/data\/ &#8211;directoryperdb mongorestore: \/data\/mongodb-linux-x86_64-1.8.1\/bin\/mongorestore &#8211;dbpath \/data\/mongodb-linux-x86_64-1.8.1\/data\/ &#8211;directoryperdb \/data\/dbname\/ chown -R mongodb:mongodb &hellip; <a href=\"https:\/\/www.strongd.net\/?p=1285\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">mongodb\u6570\u636e\u8fc1\u79fb2\u79cd\u65b9\u5f0f\u6bd4\u8f83<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,7,20],"tags":[10],"class_list":["post-1285","post","type-post","status-publish","format-standard","hentry","category-linux","category-nosql","category-20","tag-mongodb"],"_links":{"self":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/1285","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1285"}],"version-history":[{"count":1,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/1285\/revisions"}],"predecessor-version":[{"id":1286,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/1285\/revisions\/1286"}],"wp:attachment":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1285"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1285"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1285"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}