I use a mongoexport > mongoexport -h [host]:[port] -d [database] -u [user] -p [password] -c [collection] -o [path, e.g. ~/tmp/mongoexport/export.json]
And a mongoimport > mongoimport -h [host]:[port] -d [database] -u [user] -p [password] -c [collection] --file [file, e.g. ~/tmp/mongoexport/export.json] Replace the square brackets... Hope that helps. On 26 August 2010 22:41, Chris Hanks <[email protected]> wrote: > Not sure what that error message means, sorry. You might ask in the > MongoDB google group - 10gen is good about helping users with issues: > > http://groups.google.com/group/mongodb-user > > Also, I should have mentioned before that there's a guide to > mongorestore and the other MongoDB import/export tools here: > > > http://www.mongodb.org/display/DOCS/Import+Export+Tools#ImportExportTools-mongorestore > > > > > > On Aug 26, 2:22 pm, Ginny Hendry <[email protected]> wrote: > > Chris- > > > > Thanks. That got me most of the way there but I needed to extract > > those four fields from the URL I connect with (in ENV['MONGOHQ_URL']) > > that looks like this: > > > > "mongodb://app123456:[email protected]:27078/app123456" > > > > This dump command seemed to work for me: > > > > mongodump -hflame.mongohq.com:27078 -dapp123456 -uapp123456 - > > palongstring > > > > It created a dump subdirectory with what looks like my collections. > > Now how do I restore it to a local database? > > > > I tried several variations of this command > > > > mongorestore -hlocalhost:27017 -dapp123456 > > > > and got: > > > > connected to: localhost:27017 > > don't know what to do with [dump] > > > > so I'm not sure what mongorestore wants. I am running mongod 1.6.1 > > locally with default settings. > > > > Thanks. > > > > -Ginny > > > > On Aug 26, 12:45 am, Chris Hanks <[email protected]> > > wrote: > > > > > > > > > Use the mongodump utility from the command line. It comes with > > > mongodb, and can be pointed at whatever remote database you like. > > > > > For example, try a ruby script that looks something like: > > > > > host = 'flame.mongohq.com:27000' > > > db = 'ginnys-database' > > > user = 'ginny' > > > pass = 'password' > > > > > `mongodump -h#{host} -d#{db} -u#{user} -p#{pass} --out ~/dump` > > > > > That'll dump the entire contents to your local ~/dump folder. If you > > > need to restore them, you can use mongorestore, which takes similar > > > arguments. > > > > > On Aug 25, 9:44 pm, Ginny Hendry <[email protected]> wrote: > > > > > > Am I right in assuming that Heroku bundles don't include MongoHQ > data? > > > > > > Do db:pull or taps work with MongoHQ? > > > > > > If not, what are our options for backup and restore for MongoHQ > > > > databases? > > > > > > I'm sure MongoHQ has backups in case their disks crash but I need my > > > > own backups in case I or a user destroys something important. > > > > > > Thx. > > > > > > -Ginny > > -- > You received this message because you are subscribed to the Google Groups > "Heroku" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<heroku%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/heroku?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Heroku" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/heroku?hl=en.
