Querying Sharded and Replicated System

14 views
Skip to first unread message

Ed Brown

unread,
Apr 29, 2012, 7:40:52 PM4/29/12
to mongod...@googlegroups.com
I have a Mongo system set up so that it is sharded and contains a replica set. I want to load documents into the primary and query against the secondary. Do I need to have "mongos" processes for both the primary and the secondary system or do I just have mongos processes for the primary and when I  want to query, I specify "slaveOK"?

Thanks.

---
Ed Brown

Max Schireson

unread,
Apr 29, 2012, 8:10:31 PM4/29/12
to mongod...@googlegroups.com

http://www.mongodb.org/display/DOCS/Connecting+to+Replica+Sets+from+Clients

You don't need a mongos unless you are sharding. Details vary with he driver you are using.

-- Max

--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To view this discussion on the web visit https://groups.google.com/d/msg/mongodb-user/-/ZppwBoX_mfAJ.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.

Ed Brown

unread,
Apr 30, 2012, 12:13:31 PM4/30/12
to mongod...@googlegroups.com

Ed Brown

unread,
Apr 30, 2012, 12:13:38 PM4/30/12
to mongod...@googlegroups.com


On Sunday, April 29, 2012 8:10:31 PM UTC-4, Max Schireson wrote:

http://www.mongodb.org/display/DOCS/Connecting+to+Replica+Sets+from+Clients

You don't need a mongos unless you are sharding. Details vary with he driver you are using.


That's my question, I am sharding. So I understand that I need the mongos, but do I need the mongos on the replicated servers to be able to query the secondary or will mongos handle querying the secondary if I specify "slaveOK"?


-- Max

On Apr 29, 2012 4:40 PM, "Ed Brown" <edbro...@gmail.com> wrote:
I have a Mongo system set up so that it is sharded and contains a replica set. I want to load documents into the primary and query against the secondary. Do I need to have "mongos" processes for both the primary and the secondary system or do I just have mongos processes for the primary and when I  want to query, I specify "slaveOK"?

Thanks.

---
Ed Brown

--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To view this discussion on the web visit https://groups.google.com/d/msg/mongodb-user/-/ZppwBoX_mfAJ.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.

On Sunday, April 29, 2012 8:10:31 PM UTC-4, Max Schireson wrote:

http://www.mongodb.org/display/DOCS/Connecting+to+Replica+Sets+from+Clients

You don't need a mongos unless you are sharding. Details vary with he driver you are using.

-- Max

On Apr 29, 2012 4:40 PM, "Ed Brown" <edbro...@gmail.com> wrote:
I have a Mongo system set up so that it is sharded and contains a replica set. I want to load documents into the primary and query against the secondary. Do I need to have "mongos" processes for both the primary and the secondary system or do I just have mongos processes for the primary and when I  want to query, I specify "slaveOK"?

Thanks.

---
Ed Brown

--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To view this discussion on the web visit https://groups.google.com/d/msg/mongodb-user/-/ZppwBoX_mfAJ.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.

Adam C

unread,
Apr 30, 2012, 12:45:48 PM4/30/12
to mongod...@googlegroups.com
Yes, if you pass slaveOK to the mongos it will send the queries to (arbitrarily selected) secondaries, in a very similar way to when you connect via a driver to a regular replica set.

Adam

Ed Brown

unread,
Apr 30, 2012, 12:55:05 PM4/30/12
to mongod...@googlegroups.com


On Monday, April 30, 2012 12:45:48 PM UTC-4, Adam C wrote:
Yes, if you pass slaveOK to the mongos it will send the queries to (arbitrarily selected) secondaries, in a very similar way to when you connect via a driver to a regular replica set.

Adam

That answers my question.
Thank you.

---
Ed Brown

Reply all
Reply to author
Forward
0 new messages