mongodb backup data before a month ago
I would like to ask for big take, there is no way to back up a month before the data written into the script.
Use mongodump method or other methods, I find a look on the Internet, probably as follows:
#?/bin/bash
daybak=`date -d ‘-35 day’ +%F`
Day=`date -d ‘-35 day’ +%s`
mkdir -p /data/mongodb_backup/mongodb_backup_$daybak
SBtring=”‘{\”createTime\”:{\$gte:Date($Day)}}'”
/usr/local/mongodb/bin/mongodump –port 27017 -d test_mongodb -c testCarPositionRecord -q $SBtring -o /data/mongodb_backup/mongodb_backup_$daybak
Recent Comments