1

Is there any possibility to deploy a structure in case if when one or two mongod(s) in sharded cluster will be unavailable, so we'll be able to read and write partial results in\from remaining shards? But in the current case I don't want to deploy Replicaset structure. Just for the clarification, our sharded structure must be without replicasets. Thank you.

0

You haven't mentioned what driver you will be using, so I can't give you a direct link to the specific option in your language of choice, but yes there is an option to return partial results from a sharded cluster if there are shards down (I still don't advocate running without replica sets, but that's a different discussion).

You can set it in the shell as follows (sample values, will work for findOne also):

db.collection.find({}, {}, 0, 0, 0, DBQuery.Option.partial)

Each of the drivers should have support for setting this option, either directly or similar to the shell via an option. See the partial option toward the bottom of the node.js cursor documentation for example or the DBCursor setOptions and associated QUERYOPTION_PARTIAL in Java. For reference, the relevant feature requests to add partial results options are SERVER-2020 and SERVER-4610

  • I asked developer, who working on this and he said that we use Spring Mongo. So, as you said, by default I can just disable one or two of my shards and I'll be able to read only information from another (working shards)? – bronze Jul 8 '14 at 14:10
  • Spring is a Java framework, so the options I pointed to for Java are available, though you may need to do a little work to get them to work with Spring (sorry, don't know the framework). You should be ready for it to be slower in the failure scenario of course, since it can be hard to distinguish between a slow shard and a down shard, but at least it will work eventually – Adam C Jul 8 '14 at 15:15
  • Where should I enable the command db.collection.find({}, {}, 0, 0, 0, DBQuery.Option.partial)? I want to be sure that I'm doing everything correctly. Sorry for maybe stupid questions. Thank you. – bronze Jul 8 '14 at 20:06
  • since you are using spring, you want to get the developer to use setOptions and QUERYOPTION_PARTIAL as mentioned in the answer. The command example is for if you are running a query from the mongo shell, not Java – Adam C Jul 8 '14 at 22:42

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.