Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-10286

rs.add should include _id in upgrade-config-servers-to-replica-set documentation

    XMLWordPrintableJSON

Details

    Description

      Here is a ticket to help fix the documentation to convert SCCC to CSRS, more specifically for rs.add step. Given the rs.add overloads

      rs.add(hostportstr)
      rs.add(membercfgobj)

      Documentation was pointing to do statement similar to this
      rs.add(

      { host: <host:port>, priority: 0, votes: 0 }

      )

      however, it threw an exception as below
      csrsN2:PRIMARY> rs.add(

      { host: "ip-10-167-108-10:17309", priority: 0, votes: 0 }

      )
      {
      "ok" : 0,
      "errmsg" : "NoSuchKey: _id field is missing for member:

      { host: \"ip-10-167-108-10:17309\", priority: 0.0, votes: 0.0 }

      ",
      "code" : 93,
      "$gleStats" :

      { "lastOpTime" : Timestamp(0, 0), "electionId" : ObjectId("7fffffff0000000000000001") }

      }

      so I modified the add operation with _id as below and it did work.

      rs.add(

      { _id: 1, host: "ip-10-167-108-10:17109", priority: 0, votes: 0 }

      )
      rs.add(

      { _id: 2, host: "ip-10-167-108-10:17209", priority: 0, votes: 0 }

      )
      rs.add(

      { _id: 3, host: "ip-10-167-108-10:17309", priority: 0, votes: 0 }

      )
      {
      "ok" : 1,
      "$gleStats" :

      { "lastOpTime" : Timestamp(1495216622, 3), "electionId" : ObjectId("7fffffff0000000000000001") }

      }

      rs.status()
      csrsN2:PRIMARY> rs.status()
      {
      "set" : "csrsN2",
      "date" : ISODate("2017-05-19T17:57:38.600Z"),
      "myState" : 1,
      "term" : NumberLong(1),
      "configsvr" : true,
      "heartbeatIntervalMillis" : NumberLong(2000),
      "members" : [
      {
      "_id" : 0,
      "name" : "ip-10-167-108-10:17119",
      "health" : 1,
      "state" : 1,
      "stateStr" : "PRIMARY",
      "uptime" : 1126,
      "optime" :

      { "ts" : Timestamp(1495216655, 2), "t" : NumberLong(1) }

      ,
      "optimeDate" : ISODate("2017-05-19T17:57:35Z"),
      "electionTime" : Timestamp(1495215532, 1),
      "electionDate" : ISODate("2017-05-19T17:38:52Z"),
      "configVersion" : 4,
      "self" : true
      },
      {
      "_id" : 1,
      "name" : "ip-10-167-108-10:17109",
      "health" : 1,
      "state" : 2,
      "stateStr" : "SECONDARY",
      "uptime" : 35,
      "optime" :

      { "ts" : Timestamp(1495216655, 2), "t" : NumberLong(1) }

      ,
      "optimeDate" : ISODate("2017-05-19T17:57:35Z"),
      "lastHeartbeat" : ISODate("2017-05-19T17:57:36.884Z"),
      "lastHeartbeatRecv" : ISODate("2017-05-19T17:57:37.897Z"),
      "pingMs" : NumberLong(0),
      "syncingTo" : "ip-10-167-108-10:17119",
      "configVersion" : 4
      },
      {
      "_id" : 2,
      "name" : "ip-10-167-108-10:17209",
      "health" : 0,
      "state" : 8,
      "stateStr" : "(not reachable/healthy)",
      "uptime" : 0,
      "optime" :

      { "ts" : Timestamp(0, 0), "t" : NumberLong(-1) }

      ,
      "optimeDate" : ISODate("1970-01-01T00:00:00Z"),
      "lastHeartbeat" : ISODate("2017-05-19T17:57:36.895Z"),
      "lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
      "pingMs" : NumberLong(0),
      "lastHeartbeatMessage" : "not running with --replSet",
      "configVersion" : -1
      },
      {
      "_id" : 3,
      "name" : "ip-10-167-108-10:17309",
      "health" : 0,
      "state" : 8,
      "stateStr" : "(not reachable/healthy)",
      "uptime" : 0,
      "optime" :

      { "ts" : Timestamp(0, 0), "t" : NumberLong(-1) }

      ,
      "optimeDate" : ISODate("1970-01-01T00:00:00Z"),
      "lastHeartbeat" : ISODate("2017-05-19T17:57:36.895Z"),
      "lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
      "pingMs" : NumberLong(0),
      "lastHeartbeatMessage" : "not running with --replSet",
      "configVersion" : -1
      }
      ],
      "ok" : 1,
      "$gleStats" :

      { "lastOpTime" : Timestamp(1495216622, 3), "electionId" : ObjectId("7fffffff0000000000000001") }

      }

      Reporter: Shyam Arjarapu
      E-mail: shyam@mongodb.com

      Attachments

        Activity

          People

            nick.larew@mongodb.com Nicholas Larew
            xgen-internal-docs Docs Collector User (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              6 years, 10 weeks, 2 days ago