隨筆-193  評論-715  文章-1  trackbacks-0
          Reference page: Http://docs.mongodb.org/master/tutorial/install-mongodb-on-os-x/

          1, install brew, if it is exist, skip this step.
          Reference page:  http://mxcl.github.com/homebrew/
          Execute the following command:
          #/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"

          2, install MongoDB:
          #brew update
          #brew install mongodb

          3, use mondod command to startup MongoDB
          #nohup mongod &

          4, enter mongo shell for testing:
          #mongo

          MongoDB shell version: 2.0.5
          connecting to: test
          > db.test.save({a:1})
          > db.test.find()
          { "_id" : ObjectId("4fca4824293f5115fa740813"), "a" : 1 }

          5, GUI client recommendations:

          MongoExplorer
          MongoHub

          6, MongoDB has provided a web base management inerface:
          http://localhost:28017/

          7, export and import:
          $ mongodump -h test.xxxx.com:52000 -d dataname -o /home/aa/dev/mongodb/data

          mongodump mongo導(dǎo)出數(shù)據(jù)庫命令 mongodump --help 可以查看該命令下所有的幫助

          -h 導(dǎo)出源
          -d 要導(dǎo)出的數(shù)據(jù)庫名稱
          -o 數(shù)據(jù)庫要導(dǎo)出的位置

          在終端滾過N行之后,數(shù)據(jù)庫導(dǎo)出完成,可以去/home/aa/dev/mongodb/data 目錄下查看導(dǎo)出的文件,bson格式的(我導(dǎo)出后沒有馬上就看到文件,等了一會才出現(xiàn)的,原因不明)

          然后數(shù)據(jù)庫恢復(fù)使用:mongorestore 命令

          $ mongorestore -d cmsdev  /home/xx/dev/mongodb/data/cmsdev

          -d 使用的數(shù)據(jù)庫名稱
          后面直接加你剛才導(dǎo)出的目錄,這樣是直接恢復(fù)所有表

          如果-c 是恢復(fù)一個(gè)表
          posted on 2012-06-03 01:15 Robin's Programming World 閱讀(1636) 評論(0)  編輯  收藏 所屬分類: 其它
          主站蜘蛛池模板: 内江市| 丽江市| 呼图壁县| 平泉县| 黄大仙区| 汪清县| 印江| 嘉禾县| 乌拉特后旗| 莒南县| 长白| 黎川县| 富宁县| 绥芬河市| 曲松县| 南投市| 台州市| 新安县| 呈贡县| 西和县| 怀安县| 集贤县| 金寨县| 郁南县| 来凤县| 慈利县| 南雄市| 泌阳县| 苏州市| 湘西| 赫章县| 蓬莱市| 大名县| 云南省| 文成县| 玉门市| 铜陵市| 翁源县| 夹江县| 左云县| 鹤山市|