mongodb java driver - com.mongodb.MongoException: can't find a master -


i trying connect remote mongodb. developed application local mongodb. deployed application dev , configured dev mongodb. getting following exception.

caused by: com.mongodb.mongoexception: can't find master     @ com.mongodb.dbtcpconnector.checkmaster(dbtcpconnector.java:509)     @ com.mongodb.dbtcpconnector.call(dbtcpconnector.java:266)     @ com.mongodb.dbapilayer$mycollection.__find(dbapilayer.java:289)     @ com.mongodb.dbapilayer$mycollection.__find(dbapilayer.java:274)     @ com.mongodb.dbcursor._check(dbcursor.java:368)     @ com.mongodb.dbcursor._hasnext(dbcursor.java:459)     @ com.mongodb.dbcursor.hasnext(dbcursor.java:484) 

the funny thing can connect dev mongodb replica set server addresses local application, when try have application(deplyed dev) connect dev mongodb, see error above.

i wondering if there has faced same issue , resolved it.

this confounding aspect of mongodb has clashing principles of political science in voting policy.

here how happens.

  • a replica set exists; must have odd number of voting nodes.
  • the primary node fails because server / network goes down or brought down. other nodes may fail importantly...
  • an number of nodes remain no primary.
  • the remaining number of nodes cannot settle on primary , caught in political deadlock (aka hung parliament no majority).
    • a re-election occurs primary still down; deadlock. loop here.

one solution sway election assigning weight votes such candidates no longer equal. in mongo world, done assigning priority members.

priority comparisons priority setting affects elections. members prefer vote members highest priority value.

one entering mongo shell (on admin) , updating rs.conf

cfg = rs.conf() cfg.members[0].priority = 100 cfg.members[1].priority = 99 cfg.members[3].priority = 98 rs.reconfig(cfg) 

under configuration, when primary member 0 fails member 1 voted primary.

here links:

http://docs.mongodb.org/manual/core/replica-set-elections/

http://docs.mongodb.org/manual/core/replica-set-architecture-four-members/

finally, situation common on cloud architecture techniques availability sets, scaling , down -- time,cpu,load or other metrics -- , should handled random or unfair discriminating policy default replica sets. without techniques primary on default replica set going deadlock @ point, making unavailable. significant failure in opinion.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -