1

Is there a way in MongoDB 3.0 to allow users access to only a single replica set node?

We have a lot more data on disk than we do memory. So to keep our production support from paging into memory data that is not needed by our applications, we would like to designate the primary and a couple secondaries for our applications and a single secondary for read-only prod support access. Is that possible?

Thank you

  • I've added an answer to your question; but to be honest, this approach isn't how MongoDB was designed. To address problems of your data not fitting in memory, you'd be better off with two different approaches: 1, adding more RAM; and 2, sharding your data so there's less data needing to fit into each node's RAM. – Vince Bowdren Mar 2 '17 at 16:28
0

In part, yes; in part, no.

Yes: you can direct reads to secondary node, using a suitable readPreference - perhaps based on nodes being tagged/. However, if you relying on a particular secondary node being available then you can run into real difficulties if that particular node goes down, so beware.

No: all writes will go to the Primary, and there's nothing you can do to change that. If your production support needs to do any writes at all (even side-effect writes such as login auditing), that will affect which data is held in memory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.