0

after recovering replica-set from a snapshot (for testing) when I run commands on the primary I got error

not master and slaveOk=false

does primary not equal to master? I got this output for the command rs.isMaster() on the primary.

shard2-replset:PRIMARY> rs.isMaster()
{
    "hosts" : [
        "mongo-stage-rs-01-a.prod:27018",
        "mongo-stage-rs-01-b.prod:27018"
    ],
    "setName" : "shard2-replset",
    "setVersion" : 17,
    "ismaster" : false,
    "secondary" : true,
    "primary" : "mongo-stage-rs-01-b.prod:27018",
    "me" : "mongo-stage-rs-01-b.prod:27018",
    "electionId" : ObjectId("7fffffff0000000000000028"),
    "maxBsonObjectSize" : 16777216,
    "maxMessageSizeBytes" : 48000000,
    "maxWriteBatchSize" : 1000,
    "localTime" : ISODate("2019-05-15T17:09:13.275Z"),
    "maxWireVersion" : 4,
    "minWireVersion" : 0,
    "ok" : 1
}

is it make sence that the "primary" and "me" is the same, but yet "secondary" : true and "ismaster" : false,

    "ismaster" : false,
    "secondary" : true,
    "primary" : "mongo-stage-rs-01-b.prod:27018",
    "me" : "mongo-stage-rs-01-b.prod:27018",

mongodb version 3.2

  • 1
    It says "mongo-stage-rs-01-b.prod:27018" as both primary and secondary. It is not possible. what is the rs.status() value. – Mani May 15 at 19:56
  • already fixed so I cannot add the output now, the solution was from docs.mongodb.com/v3.2/tutorial/restore-sharded-cluster to start the shard with mongod --setParameter=recoverShardingState=false --replSet <replSetName> then run: use admin db.system.version.remove( { _id: "minOpTimeRecovery" }, { writeConcern: { w: "majority" } } ) – Maoz Zadok May 19 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.