C:\Program Files\mongodb\bin
//备份 mongodump -h 127.0.0.1:27017 -d test -o c:\data\dump
//恢复 mongorestore -h 127.0.0.1:27017 -d test --directoryperdb c:\data\dump\test
-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 ( <set
name>/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
--authenticationDatabase arg user source (defaults to dbname)
--authenticationMechanism arg (=MONGODB-CR)
authentication mechanism
--dbpath arg directly access mongod database files
in the given path, instead of
connecting to a mongod server - needs
to lock the data directory, so cannot
be used if a mongod is currently
accessing the same path
--directoryperdb each db is in a separate directly
(relevant only if dbpath specified)
--journal enable journaling (relevant only if
dbpath specified)
-d [ --db ] arg database to use
-c [ --collection ] arg collection to use (some commands)
--objcheck validate object before inserting
(default)
--noobjcheck don't validate object before inserting
--filter arg filter to apply before inserting
--drop drop each collection before import
--oplogReplay replay oplog for point-in-time restore
--oplogLimit arg include oplog entries before the
provided Timestamp (seconds[:ordinal])
during the oplog replay; the ordinal
value is optional
--keepIndexVersion don't upgrade indexes to newest version
--noOptionsRestore don't restore collection options
--noIndexRestore don't restore indexes
--w arg (=0) minimum number of replicas per write
vim /home/mongoBeiFen.sh
#!/bin/bash shijie=`date +%Y%m%d%H` backmongodbFile=mongodb$shijie.tar.gz cd /home/mongoDbback/ /usr/local/mongo/bin/mongodump -h 127.0.0.1 --port 27017 -u mongo -p 123456 -d my_mongodb -o my_mongodb_dump/ tar czf $backmongodbFile my_mongodb_dump/ rm my_mongodb_dump -rf
./mongoBeiFen.sh
/usr/local/mongo/bin/mongorestore -d my_mongodb my_mongodb_dump/my_mongodb/*
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有