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

mongod --outputConfig produces incorrect YAML option name (replSet vs. replSetName)

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.1.0-rc0
    • Affects Version/s: 4.4.8, 5.0.5
    • Component/s: None
    • None
    • Server Security
    • Fully Compatible
    • ALL
    • v7.0, v6.0, v5.0, v4.4
    • Hide

       

      https://www.mongodb.com/docs/manual/reference/program/mongod/#std-option-mongod.–replSet{{}}

      Running: "mongod --replSet s0 --logpath "/data/logs/s0-r0.log" --dbpath /data/shard0/rs0 --bind_ip_all --port 37017 --fork --outputConfig" produces the following YAML output. 

      Output below (generated by --outputConfig) to be used as a mongod configuration file.

      net:
      bindIp: "*"
      port: 37017
      outputConfig: true
      processManagement:
      fork: true
      replication:
      replSet: s0
      storage:
      dbPath: /data/shard0/rs0
      systemLog:
      destination: file
      path: /data/logs/s0-r0.log

      However, if you use this output as a configuration file, mongod will not start as you get the following error:

      "Unrecognized option: replication.replSet"

      The following manual correction in the YAML file  below allows mongod to start

      replication:
      replSetName: s0

       

      https://www.mongodb.com/docs/manual/reference/configuration-options/#mongodb-setting-replication.replSetName

       

      --outputConfig should output the correct name (replSetName) for use in the YAML file as it is different from the name that needs to be used as a command line option (replSet)

      Show
        https://www.mongodb.com/docs/manual/reference/program/mongod/#std-option-mongod .–replSet {{}} Running: "mongod --replSet s0 --logpath "/data/logs/s0-r0.log" --dbpath /data/shard0/rs0 --bind_ip_all --port 37017 --fork -- outputConfig "   produces the following YAML output.  Output below (generated by --outputConfig) to be used as a mongod configuration file. net: bindIp: "*" port: 37017 outputConfig: true processManagement: fork: true replication: replSet: s0 storage: dbPath: /data/shard0/rs0 systemLog: destination: file path: /data/logs/s0-r0.log However, if you use this output as a configuration file, mongod will not start as you get the following error: "Unrecognized option: replication.replSet" The following manual correction in the YAML file  below allows mongod to start replication: replSetName: s0   https://www.mongodb.com/docs/manual/reference/configuration-options/#mongodb-setting-replication.replSetName   --outputConfig should output the correct name (replSetName) for use in the YAML file as it is different from the name that needs to be used as a command line option (replSet)
    • Security 2022-12-12, Security 2022-12-26, Security 2023-01-09, Security 2023-01-23, Security 2023-02-06, Security 2023-05-01, Security 2023-05-15, Security 2023-06-12, Security 2023-07-24, Security 2023-08-07, Security 2023-08-21

      Using "–outputConfig" to create a YAML configuration file produces an incorrect option name for the replica set name.  Tested in 5.0.5 but also seen in other versions of MongoDB (4.4.8) and likely many others.

       

       

            Assignee:
            shreyas.kalyan@mongodb.com Shreyas Kalyan
            Reporter:
            gary.taylor@mongodb.com Gary Taylor
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: