I have a mongodb replicaset configured with 3 replicas. My configurations are
staging:
sessions:
default:
hosts:
- xx.x.x.xxx:27017
- xx.x.x.xxx:27017
- xx.x.x.xxx:27017
database: mongoid_staging
options:
consistency: strong
options:
allow_dynamic_fields: false
identity_map_enabled: true
include_root_in_json: false
include_type_for_serialization: true
This configuration would ensure that all my writes and reads are always directed to the primary because of the strong
consistency. How can i routes specific read queries to the secondaries?
Or to put it another way how can ensure that certain reads are done only from the primary?
I am using Mongoid 3.0.0 and Mongodb 2.2.6. Is this even possible? This article says it can be done with Mongoid 3 but i could not find any thing that tells me how - https://groups.google.com/forum/#!topic/mongoid/pTa4eAWv7gM
Second question:
Can a separate application connect to one of the secondaries in a replicaset and use it as its standalone primary?