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