茶亦醉人何必酒,书能香我无须花!

张帆风顺破重浪,兰幽山间心坦荡。 斌礼厚徳创伟业,志壮凌云走四方!
posts - 169, comments - 560, trackbacks - 8, articles - 4
  博客园 :: 首页 ::  :: 联系 :: 订阅 订阅 :: 管理
mongodb mongodump and mongorestore

abeen@localhost:/program/mongodb-1.4/bin$ mongodump --help
options:
  --help                   produce help message
  -h [ --host ] arg        mongo host to connect to
  -d [ --db ] arg          database to use
  -c [ --collection ] arg  collection to use (some commands)
  -u [ --username ] arg    username
  -p [ --password ] arg    password
  --dbpath arg             directly access mongod data files in this path,
                           instead of connecting to a mongod instance
  -v [ --verbose ]         be more verbose (include multiple times for more
                           verbosity e.g. -vvvvv)
  -o [ --out ] arg (=dump) output directory

Example:

  1 #!/bin/sh
  2
  3 rm -rf /home/abeen/z_abeen_back/database_back/*
  4 cd /program/mongodb-1.4/bin
  5 ./mongodump -h 192.168.1.3 -d test -o /home/abeen/z_abeen_back/database_back
  6 exit 0


abeen@localhost:/program/mongodb-1.4/bin$ mongorestore --help
usage: /usr/lib/mongodb/mongorestore [options] [directory or filename to restore from]
options:
  --help                  produce help message
  -h [ --host ] arg       mongo host to connect to
  -d [ --db ] arg         database to use
  -c [ --collection ] arg collection to use (some commands)
  -u [ --username ] arg   username
  -p [ --password ] arg   password
  --dbpath arg            directly access mongod data files in this path,
                          instead of connecting to a mongod instance
  -v [ --verbose ]        be more verbose (include multiple times for more
                          verbosity e.g. -vvvvv)

Example:
 mongorestore -h 92.168.1.3 --directoryperdb /home/abeen/z_abeen_back/database_back/test       
发表评论

昵称: [登录] [注册]

主页:

邮箱:(仅博主可见)

评论内容:

  登录  注册

[使用Ctrl+Enter键快速提交评论]

0 2085185 dBbFHUvvNTM=