ruby on rails - MongoDB: Different applications connecting to different replicas -


we use mongodb central database our application; consumer facing mobile app. @ present 7-member replica-set replica-set-1 being master @ moment. backend connects mongo replica build in ruby on rails , use mongoid odm.

there 3 pieces connecting mongodb replica-set.

  1. the consumer application
  2. the admin , customer care management application
  3. the data retrieval application ( analytics , such purposes )

all these 3 apps connect same replica set of now.

what know whether possible connect different applications specific replicas.

for example, mobile app connects primary writes , replicas 2-4  read; customer care management application connects primary  ( writes ) , replicas 5-7 reads.  

i dont think explicitly mentioning specific replicas in mongoid.yml configuration working. though have mentioned replica-set-7 in mongoid hosts file data retrieval application, see queries in log file of replica-set-2 , 3.

so obviously, mongodb decides criteria distribute queries among replicas despite configuration specified @ client mongoid end.

i love know if such thing possible @ using mongodb , mongoid solve lot of our load issues. right heavy queries customer care , data retrieval apps affects consumer facing mobile app well; reads not segragated. separate out reads.

also, if @ possible, again have eyes raised on possible pitfalls this; specially 3 applications can write db. example, replica-3 becomes primary after election , not explicitly mentioned in configuration of data retrieval application. might happen there become concern.

i not @ sure whether possible; wanted know if theres way figure out this. appreciable.

when connect member of replica set, client told full state of replica set , can connect of them. initial set of hosts seeds process - long application can reach 1 of hosts, doesn't matter hosts in configuration.

mongo have concept of tagged replica set members. when creating connection or executing query can specify tags use select replica set member read from.


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -