Replica Sets

19 views
Skip to first unread message

Tim

unread,
Dec 10, 2010, 4:17:15 AM12/10/10
to Mongoid, steve....@g5searchmarketing.com
I saw this post from a long time ago, http://bit.ly/eZRUCT. I am
wondering if any effort is/has been made to get replica sets into
Mongoid yet? We are deploying Mongo into production in the next few
weeks and would REALLY like to use replica sets but we REALLY love
Mongoid! If nobody is working on this we are going to evaluate
picking it up and getting it into Mongoid.


Thanks for all your work, Tim

matthewford

unread,
Dec 10, 2010, 10:25:04 AM12/10/10
to Mongoid
It's in the ruby driver, I saw in a post somewhere you can just
override the connection to use the ruby driver (think on the mongodb
mailing list).

Matt

On Dec 10, 9:17 am, Tim <tim.linqu...@gmail.com> wrote:
> I saw this post from a long time ago,http://bit.ly/eZRUCT.  I am

Tim

unread,
Dec 10, 2010, 3:31:02 PM12/10/10
to Mongoid
Thanks Matt. We are actively testing now and see that the newly
promoted master is detected through the driver and we are able to
execute queries against the new master through Mongoid. After taking
closer look @ the link I referenced it appears that most of the issues
were just related to the cleanliness of Mongoid ie referencing master/
slave instead of "node" or replica set.

We're going to be moving forward this. We'll post a result of our
findings. I have seen a lot of other inquiries about this and
confusion as to whether not Mongoid will work with a replica set
setup.

Tim

Eric Woodward

unread,
Dec 10, 2010, 5:24:50 PM12/10/10
to Mongoid

Please do post your results. I ran a series of fire drills last week
and Mongoid did not pick up and switch to the new master, at least
with my configuration. It simply started failing.

--ejw

Eric Woodward
Email: m...@ejw.com

Alex Wolfe

unread,
Dec 31, 2010, 11:56:54 AM12/31/10
to Mongoid
Hi Tim. Any luck getting Mongoid to automatically detect a new master
in a replica set?

Alex

Eric Woodward

unread,
Dec 31, 2010, 10:46:10 PM12/31/10
to Mongoid

Alex,

I moved to a setup connecting to a local mongos, and this has
addressed the issue, with the overhead of setting that up and
configuring it for every server that needs it, and configuration
servers. If you do not need sharding, you can always run a single
shard to one replica set.

--ejw

Kyle Banker

unread,
Jan 1, 2011, 10:49:23 AM1/1/11
to Mongoid
If you're using the latest version of the Ruby driver, and have
configured your connection correctly, then you'll have no trouble
handling replica set failover.

Note that the driver doesn't reconnect automatically but on the
subsequent request. This means that you may have to catch a few
ConnectionFailure exceptions while the replica set itself is failing
over. See these docs:
http://api.mongodb.org/ruby/1.1.5/file.REPLICA_SETS.html

Andrew Coldham

unread,
Jan 1, 2011, 7:10:53 PM1/1/11
to mon...@googlegroups.com, Mongoid
It's straight forward to adapt Kyle's sample to add retry in the master connection code.

Sent from my iPhone

Eric Woodward

unread,
Jan 1, 2011, 10:37:35 PM1/1/11
to Mongoid

Kyle,

As of Dec 10, the date of my first note, this was not working. If the
master disappeared all requests just started failing. mongos is what
we had to do to address the issue right away. Glad to hear that is no
longer necessary.

--ejw

Kyle Banker

unread,
Jan 1, 2011, 11:43:08 PM1/1/11
to Mongoid
Eric,

This requests will fail until a new master is elected. Is that what
you were experiencing, or was it something different? If you have a
chance to run the latest driver code, and if it doesn't work, I'd love
to help get to the bottom of it.

Kyle
Reply all
Reply to author
Forward
0 new messages