mongodb是目前最流行的nosql数据库,其自身也提供了备份与恢复命令 。具体程序为mongodump和mongorestore 。
一、mongodump备份
mongodump的具体用法可以查看帮助:
[root@web20 ~]# /App/mongodb/bin/mongodump -h
ERROR: required parameter is missing in 'host'
Export MongoDB data to BSON files.
options:
--help produce help message
-v [ --verbose ] be more verbose (include multiple times for more
verbosity e.g. -vvvvv)
--version print the program's version and exit
-h [ --host ] arg mongo host to connect to ( /s1,s2 for
sets)
--port arg server port. Can also use --host hostname:port
--ipv6 enable IPv6 support (disabled by default)
-u [ --username ] arg username
-p [ --password ] arg password
--dbpath arg directly access mongod database files in the given
path, instead of connecting to a mongod server -
needs to lock