November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

mongodb backup data before a month ago

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

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>