April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

Categories

April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

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>