June 2017
M T W T F S S
 1234
567891011
12131415161718
19202122232425
2627282930  

Categories

June 2017
M T W T F S S
 1234
567891011
12131415161718
19202122232425
2627282930  

MongoDB DB backup

MongoDB DB backup

[root@rmohan scripts]# cat mongodb_backup.sh #!/bin/bash PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/mysql/bin:/usr/local/mongodb/bin:/usr/local/mongodb/bin export PATH export LANG=en_US.utf8

Dbip=”192.168.1.10″ Dport=”30000″ Datetime=$(date +%Y-%m-%d_%H_%M_%S) Logfile=”/backup/mongodb/mongodbbak_10010/backmongo.log” Dblist=”$(echo ‘show dbs’|/usr/local/mongodb/bin/mongo –host ${Dbip} –port ${Dport} |egrep -v “MongoDB|connecting|bye”|awk ‘{print$1}’)”

echo -e “=======start for database backup `date +%F’ ‘%T’ ‘%u`=======\n” >>$Logfile backdbcmd(){ echo “$(date) backup $dbname” /usr/local/mongodb/bin/mongodump –host ${Dbip} –port ${Dport} –db ${dbname} –out /backup/mongodb/mongodbbak_10010/${Datetime} echo […]

Installs MongoDB based on CentOS 6.5

Installs MongoDB based on CentOS 6.5

1. Add the MongoDB installation source

vim /etc/yum.repos.d/mongodb-enterprise.repo

Write the following configuration items to the file

[Mongodb-enterprise] name = MongoDB Enterprise Repository baseurl = https://repo.mongodb.com/yum/redhat/$releasever/mongodb-enterprise/stable/$basearch/gpgcheck = 0 enabled = 1

2. Install MongoDB with yum

yum install mongodb-enterprise

3. Set the MongoDB process to boot chkconfig mongod on

[…]

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 […]