Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>That's an acceptable way to connect to the replica set. Assuming that the named server is up, the driver connection will discover the remainder of the servers in the cluster and be able to direct queries to them when permitted, and follow the "PRIMARY" designation through failover events. It's a good idea to add other servers to this "seed list", though, so that the connection can still succeed if one of the "seed" servers happens to be down.</p> <p>As for distributing reads ... this behavior is in practice at the discretion of the driver. But the generally accepted semantics is: if a slaveOk read is requested, that read query will go to a SECONDARY server if one is available; only if none are available will it go to the PRIMARY. Write queries, of course, will always go to the PRIMARY. </p> <p>One suggestion for having the PRIMARY share some of the read load, is to randomize when you flag a query as slaveOk -- <a href="http://groups.google.com/group/mongodb-user/browse_thread/thread/458812c7b9781b4e" rel="noreferrer">see the discussion here</a></p> <p>To flag a query as slaveOk in PHP, you can set this bit at several levels -- connection, database, collection, or cluster -- <a href="http://us2.php.net/manual/en/mongo.queries.php" rel="noreferrer">API details here</a> This affords several possible ways of implementing the aforementioned randomization technique -- e.g., try to make sure half the connections in your connection pool have the slaveOk bit set.</p> <p>Hope that helps!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload