2

I managed to get MongoDB running as a three member replica on Windows 8, but I had problems with configuration files. If I used the new (MongoDB 2.6) file format (YAML) and used the replica set name option as:

replication:
    replSetName: rs1

(or any of the other variants I had tried in YAML format) I would get "Invalid option: replication" error during the installation. When I switched to old conf. file format and used:

replSet=rs1

I had no problems. I am very (very!) new to all this, so I am wondering if I was doing something wrong or is it Mongo 2.6 - Windows problem. Thanks!

2

I was not able to replicate, so here's my successful YAML config file (Windows 7 64 bit, MongoDB 2.6.1):

replication:
    replSetName: "rs1"
    oplogSizeMB: 512
storage:
    dbPath: "data"
    smallFiles: true
systemLog:
    destination: file
    path: "data/mongod.log"

How I started it:

C:\Users\Adam\mongo\2.6.1\bin>mongod.exe -f mongod-yaml.conf
2014-06-03T23:23:12.528+0100 log file "C:\Users\Adam\mongo\2.6.1\bin\data/mongod
.log" exists; moved to "C:\Users\Adam\mongo\2.6.1\bin\data/mongod.log.2014-06-03
T22-23-12".

And then (after an rs.initiate()):

rs1:PRIMARY> db.serverCmdLineOpts()
{
        "argv" : [
                "mongod.exe",
                "-f",
                "mongod-yaml.conf"
        ],
        "parsed" : {
                "config" : "mongod-yaml.conf",
                "replication" : {
                        "oplogSizeMB" : 512,
                        "replSetName" : "rs1"
                },
                "storage" : {
                        "dbPath" : "data",
                        "smallFiles" : true
                },
                "systemLog" : {
                        "destination" : "file",
                        "path" : "data/mongod.log"
                }
        },
        "ok" : 1
}

Note that I had issues when I used tabs to indent, which were resolved when using spaces. Case sensitivity was also a problem, but mainly due to muscle memory from the old config options.

1
  • 1
    Spaces, yes! Thank you, it is working now. I thought it might be something trivial as that :).
    – Aineko
    Jun 4 '14 at 0:28
0

Ensure the configuration file uses ASCII encoding. mongod does not support configuration files with non-ASCII encoding, including UTF-8.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.