Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion How to read from both members of my Replica Set
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Tom DeMille  
View profile  
 More options Nov 7 2012, 1:56 pm
From: Tom DeMille <t...@boomtownroi.com>
Date: Wed, 7 Nov 2012 10:56:19 -0800 (PST)
Local: Wed, Nov 7 2012 1:56 pm
Subject: Re: [mongodb-csharp] Re: How to read from both members of my Replica Set

Thanks Robert.  

A moment ago my new secondary switched to Primary (because I configured it
incorrectly with priority 2).  When this happened my web applications
started failing with "Server is not a primary and SlaveOk is false." errors.

I understand that in one respect, in that we are NOT using slaveOK.  But
what I don't understand is why my web application, via the c# driver,
 didn't just 'find' the new primary via discovery from Mongo.  

Does the c# driver cache the replication stuff?  Would I need to do an
IISRESET or blow away my application pools in order to get the replication
information that I just recently setup?  My understanding has been that the
c# driver should have known about the 3 servers in my cluster, even though
I didn't specifically add the new IP to my connection string, and
automatically have found the new primary.

Here is my current (obscured) connect string
: mongodb://xxx.xxx.xxx.xxx/?maxpoolsize=200;waitqueuemultiple=5.0;waitqueuet imeout=120s

Tom

On Wednesday, November 7, 2012 12:16:21 PM UTC-5, Robert Stam wrote:

> In version 1.4.2 the only setting available to you is slaveOk=true or
> false.

> If you set slaveOk=true your reads will go to the secondary. If you set
> slaveOk=false your reads will go to the primary. There is no way to get the
> driver to load balance between them. You could of course do the load
> balancing yourself by alternately setting slaveOk to false or true to
> distribute the reads.

> Once you upgrade to 1.6.1 you and use the new ReadPreference setting,
> which replaces slaveOk and has more values:

> Primary (equivalent to slaveOk=false)
> PrimaryPreferred
> Secondary
> SecondaryPreferred (equivalent to slaveOk=true)
> Nearest

> Seems like Nearest would do what you want, distributing the reads between
> the primary and secondary. Note that Nearest load balances evenly (in other
> words, it doesn't measure the load, it just evenly distributes the reads
> among all eligible servers).

> On Wed, Nov 7, 2012 at 11:56 AM, Tom DeMille <t...@boomtownroi.com<javascript:>
> > wrote:

>> Check that, we can't upgrade the driver right now, using 1.4.2

>> On Wednesday, November 7, 2012 11:54:36 AM UTC-5, Tom DeMille wrote:

>>> Have a 3 node replica set, where one node is an Arbiter.  Thus at any
>>> one time I have a primary and secondary server.  I would like to allow my
>>> application to read from either one, in fact I would love to 'load balance'
>>> the load somehow.

>>> Whats the best way to achieve this?    If the primary is running 'slow'
>>> will the driver automatically read from the secondary, thus achieving a
>>> true 'load' based balance?

>>> What would the c# code/connection strings look like to accomplish this.
>>>  It seems this has changed over the past year and 1/2 and I want to check
>>> in for the latest greatest best practices.

>>> I'm using 2.2.1 Mongo.

>>> I will be updating c# driver to latest version.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.