First read the documentation related to your versions, backup, make sure that the solution below applies to your scenario, etc.
http://docs.mongodb.org/v2.4/reference/program/mongodump/
http://docs.mongodb.org/v2.4/reference/program/mongorestore/
Ssh in
rhc ssh [app-name] cd app-root/repo/
Check which version of mongodump you have:
mongodump --version mongodump version 2.4.9
mongodump
In the command below, * ALL * databases will be reset.
mongodump --host $OPENSHIFT_MONGODB_DB_HOST:$OPENSHIFT_MONGODB_DB_PORT --username $OPENSHIFT_MONGODB_DB_USERNAME --password $OPENSHIFT_MONGODB_DB_PASSWORD
Print Dump Folder
zip -r dump.zip dump
Exit SSH
exit
SCP loading
(Replace the environment variable below with the actual value).
scp OPENSHIFT_APP_UUID@appname-username.rhcloud.com :~/app-root/repo/dump.zip /var/www/html
SSH back and delete dump files
rhc ssh [app-name] cd app-root/repo/ rm -r dump rm -r dump.zip
At the local command prompt, change to the directory where you downloaded the zip file:
cd /var/www/html
Unzip the dump folder
unzip dump.zip -d dump
See which version of mongorestore you have, and that everything is compatible:
mongorestore --version mongorestore version 2.4.9
At this point, I deleted all the local * relevant * databases in RockMongo so that the recovery process creates them from scratch.
mongorestore
mongorestore dump
The default host and port used are localhost and 27017 .
user1063287
source share