Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-22386

could not contact primary



    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Replication, Sharding
    • Labels:
    • Operating System:


      We deploy sharded cluster between multi locations(data center).
      We have multi replica set for each location, Also We have use from CSRS for configsvr, and We distribute configsvr between all locations.
      Also we have 4 mongos that each mongos connect to near configsvr from config replica set name.
      Issue: When I query to find into sharded collection, I get some error,Also Why I just use from tag shard aware into all query(insert, criteria).

      I describe all details about this sharded cluster at below:
      1- mongodb version: 3.2.1
      2- QTY of locations(or Data center): 4 location to the names (thr, ifn, mhd, bnd)
      3- The location "thr" is main datacenter, Then the thr must be majority on replica set.
      4- We deploy the replica set for configsvr, and We put 4 members into thr, 4 into mhd, 4 into ifn and one member into bnd.
      5- The thr is majority, Then 3 of members is votes=1 and other is zero(CSRS)
      6- Other locations(mhd,ifn), They have just one member for votes=1(CSRS)
      7- The bnd location just one secondery with votes=0(CSRS)
      8- Each location have one replica set(3 members) for sharding.(Shard)
      9- We use tag aware for replica set
      10- We have 4 mongos, 4 replica set(3 member for two replica set, 2member for other replica set), 1 replica set configsvr(13 member)
      11- Shard key: origin_code
      12- We use tag aware

      Example of Error when I insert doc with shard key:
      mongos> db.origins.insert(


      "nInserted" : 0,
      "writeError" :

      { "code" : 7, "errmsg" : "could not contact primary for replica set thr" }


      My question is if bnd replica set(shard, configsvr, mongos of bnd is up) disconnected from sharded cluster, That must be work and even it insert and find, So when it connected to sharded cluster configsvr must be migrate chunk or doc from bnd replica set to thr replica set.
      Why thr replica set is disconnected from shard, I can't insert doc with tag thr(origin_code for the is 52).




            stennie Stennie Steneker
            ali.hallaji1@gmail.com Ali Hallaji
            0 Vote for this issue
            3 Start watching this issue