sheharyarn / mongo-sync

Sync Remote and Local MongoDB Databases :fire:
https://sheharyar.me/blog/sync-mongodb-local-and-production-heroku/
319 stars 89 forks source link

Trouble using between localhost:3001 and mLabs (Heroku)? #12

Closed deborah-ufw closed 7 years ago

deborah-ufw commented 8 years ago

Hello,

I have free Mongo DB plugin mLabs on my Heroku instance with very light data (don't want to upgrade to paid Mongo DB from Mongo HQ).

I set up my config as follows, double-checking all the values were correct:

local:
  db: 'meteor'
  host: 
    port: 3001 /*also tried 27017*/

remote:
  db: 'heroku_6l0rt5bm'
  host:
    url: 'mongodb://heroku_6l0rt5bm:mysupersecurepassword@ds059155.mlab.com:59155/heroku_6l0rt5bm'
    port: 59155
  access:
    username: 'heroku_6l0rt5bm'
    password: 'mysupersecurepassword'

But running ./mongo-sync push failed with error "Incorrect input, aborting..."

Have I accidentally left something out or done something funky, or is it possible to use the script for my case?

sheharyarn commented 8 years ago

@deborah-ufw You need to break down your remote mongodb url into individual parameters, so even though you didn't write your password in the sample above, I can still see it in the url. (Don't worry, I edited it to hide it).

It should be this:

local:
  db: 'local_db_name'
  host:
    port: 27017

remote:
  db: 'heroku_6l0rt5bm'
  host:
    url: 'ds059155.mlab.com'
    port: 59155
  access:
    username: 'heroku_6l0rt5bm'
    password: 'mysupersecurepassword'
deborah-ufw commented 7 years ago

Thank you!!!