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

rs.initiate() does not load default configuration as expected

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.5.12
    • Component/s: Replication
    • None
    • ALL
    • Hide

      Here are the steps:

      $ > mongod --port 27017 --dbpath /Users/sjcbsolo/.mongodb/data/test --logpath /Users/sjcbsolo/.mongodb/logs/test.log --logappend --logRotate rename --replSet test0 --journal --smallfiles --bind_ip 127.0.0.1 --fork
      .mongodb $ > mongo localhost:27017
      MongoDB shell version v3.5.12-93-g2d7aef7
      connecting to: localhost:27017
      MongoDB server version: 3.5.12-93-g2d7aef7
      Server has startup warnings:
      2017-10-06T15:38:11.864-0700 I CONTROL  [initandlisten]
      2017-10-06T15:38:11.864-0700 I CONTROL  [initandlisten] ** NOTE: This is a development version (3.5.12-93-g2d7aef7) of MongoDB.
      2017-10-06T15:38:11.864-0700 I CONTROL  [initandlisten] **       Not recommended for production.
      2017-10-06T15:38:11.864-0700 I CONTROL  [initandlisten]
      2017-10-06T15:38:11.864-0700 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
      2017-10-06T15:38:11.864-0700 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
      2017-10-06T15:38:11.864-0700 I CONTROL  [initandlisten]
      MongoDB Enterprise > rs.initiate({})
      {
      	"info2" : "no configuration specified. Using a default configuration for the set",
      	"me" : "sjca0bsolopro:27017",
      	"ok" : 0,
      	"errmsg" : "No host described in new configuration 1 for replica set test0 maps to this node",
      	"code" : 93,
      	"codeName" : "InvalidReplicaSetConfig"
      }
      MongoDB Enterprise > rs.initiate({
      ... _id: "test0",
      ... configsvr: false,
      ... members: [
      ...   { _id: 0, host: "localhost:27017", priority: 2 }
      ... ]})
      { "ok" : 1, "operationTime" : Timestamp(1507329694, 1) }
      MongoDB Enterprise test0:SECONDARY>
      MongoDB Enterprise test0:PRIMARY>
      
      Show
      Here are the steps: $ > mongod --port 27017 --dbpath /Users/sjcbsolo/.mongodb/data/test --logpath /Users/sjcbsolo/.mongodb/logs/test.log --logappend --logRotate rename --replSet test0 --journal --smallfiles --bind_ip 127.0.0.1 --fork .mongodb $ > mongo localhost:27017 MongoDB shell version v3.5.12-93-g2d7aef7 connecting to: localhost:27017 MongoDB server version: 3.5.12-93-g2d7aef7 Server has startup warnings: 2017-10-06T15:38:11.864-0700 I CONTROL [initandlisten] 2017-10-06T15:38:11.864-0700 I CONTROL [initandlisten] ** NOTE: This is a development version (3.5.12-93-g2d7aef7) of MongoDB. 2017-10-06T15:38:11.864-0700 I CONTROL [initandlisten] ** Not recommended for production. 2017-10-06T15:38:11.864-0700 I CONTROL [initandlisten] 2017-10-06T15:38:11.864-0700 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database. 2017-10-06T15:38:11.864-0700 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted. 2017-10-06T15:38:11.864-0700 I CONTROL [initandlisten] MongoDB Enterprise > rs.initiate({}) { "info2" : "no configuration specified. Using a default configuration for the set" , "me" : "sjca0bsolopro:27017" , "ok" : 0, "errmsg" : "No host described in new configuration 1 for replica set test0 maps to this node" , "code" : 93, "codeName" : "InvalidReplicaSetConfig" } MongoDB Enterprise > rs.initiate({ ... _id: "test0" , ... configsvr: false, ... members: [ ... { _id: 0, host: "localhost:27017" , priority: 2 } ... ]}) { "ok" : 1, "operationTime" : Timestamp(1507329694, 1) } MongoDB Enterprise test0:SECONDARY> MongoDB Enterprise test0:PRIMARY>

      When launching a replicated local 1x1 cluster (a 1 member replicaSet), the default configuration is not applied as expected and the replicaSet remains uninitiated.

      However, by passing an explicit configuration, it initializes just fine.

            Assignee:
            Unassigned Unassigned
            Reporter:
            toszter Bartosz Solowiej
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: