stripe-archive / mosql

MongoDB → PostgreSQL streaming replication
MIT License
1.62k stars 224 forks source link

mosql should support doing imports against non-replset nodes #10

Closed TheDigitalNinja closed 11 years ago

TheDigitalNinja commented 11 years ago

If you try to run it against a replset, it will warn, try to continue anyways, and die with

 /home/mosql/.rvm/gems/ruby-1.9.3-p385/gems/mosql-0.1.2/lib/mosql/cli.rb:192:in `initial_import': undefined method `[]' for nil:NilClass (NoMethodError) 
nelhage commented 11 years ago

Hm, this should definitely have a better error message.

Is your mongo server running as part of a replica set? You need to run mosql against a replica set, as documented here: http://docs.mongodb.org/manual/replication/

dpatti commented 11 years ago

This was a bit confusing for me at first, too, since it says is not a replset. Proceeding anyways.... I just didn't realize it was a requirement until I looked at the source and saw the ['local']['oplog.rs'] reference. That said, a single import should be possible whether or not you are using a replset, so it might be something to consider.

nelhage commented 11 years ago

Yeah, the intent when I made that a warning was to support doing imports against a non-replSet, but I never actually implemented it. I'll update this ticket to track the fact that that should be possible.

andrewjshults commented 11 years ago

I've added a quick patch to handle this for development work (just running a single mongo instance locally) here https://github.com/andrewjshults/mosql/tree/non-replicate-set

There's probably a cleaner way of doing this (it should probably exit after the initial import if not connected to a replica set), but this has worked so far.