TorchlightSoftware/mongo-watch

Connecting to replica sets?

lgandecki opened this issue · 6 comments

Hey there!

Is there any way to connect to replica sets with mongo-watch?
Right now it feels like I'm forced to point the MongoWatch to one specific db, but my guess is that when that server goes down then my app will stop working, even though the replica set carries on with new master.

It'd be nice to be able to provide a mongourl as a configuration, or at least an array of hosts/ports.

Thanks!

That sounds like a valid concern. I had assumed there would be some kind of load balancer on a multi-instance mongo environment, but I haven't personally worked with multiple nodes. Do you normally provide an array of host locations when connecting? What is the behavior? Does it run down the list in order and connect to the first one that responds?

You're welcome to take a stab at a solution. The code base is pretty small and well organized.

Thanks for your prompt answer!
I sent a pull request.

I tested it with my replicaSet and it worked. I also tried to point it at the master using the previous configuration and it also worked, but feel free to test!

I just realized, I also added one more change there - an optional "authdb" - in my case I'm actually authenticating using my own db, and then switching to local to read oplog.. The default behavior stays the same using the applyDefaults function. I've also updated the test so it works with this new option.

I'm in need of both of these features - thanks so much for this PR!

I am testing this and got mired in some dependency updates, and now the tests are failing with duplicate events. I'd like to get it stable again before accepting and publishing. I'm going to be out of town for a few days, but will come back to it next week.

On Sep 23, 2014, at 8:25 PM, Benjamin Kitt notifications@github.com wrote:

I'm in need of both of these features - thanks so much for this PR!


Reply to this email directly or view it on GitHub.

Sorry for the delay, I am slammed with other responsibilities. I'd recommend using @lgandecki's branch in the meantime if you have urgent need for the functionality. This is on my list, I'll try to get things passing and wrapped up by the end of next week.

Closing. #14