mongodb - Load Balancing Mongo DB on GCE instance -


the default click deploy mongodb gce sets 1 primary node, 1 secondary node , 1 arbiter node. can't figure out how mongodb manages distribute reads between primary , secondary nodes. have explicit external ip each node available don't want point apps 1 node or other ... how figure out load-balancer ip (if there such thing) can give app mongodb connection url?

in order connect replica set of mongodb, need specify hosts in standard uri connection scheme. example, describe connection replica set named test, following mongod hosts:

db1.example.net on port 27017 db2.example.net on port 2500  

you use connection string resembles following:

mongodb://db1.example.net,db2.example.net:2500/?replicaset=test  

for more information mongodb's connection string uri format, take @ artcile.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -