Question

In config file I have:

   systemLog:
        destination: file
        logAppend: true
        path: c:\data\log\mongod.log
    storage:
        dbPath: c:\data\db
        journal:
            enabled: true
    replication:
       replSetName: "rs0"
    net:
       bindIp: 127.0.0.1
       port: 27017
    security:
         authorization: enabled

enter image description here

I'm trying to connect using mongod process like in documentation:

C:\Program Files\MongoDB\Server\3.6\bin> mongod --auth --dbpath /data/db --config C:\Program Files\MongoDB\Server\3.6\mongod.cfg

And getting:

Error reading config file: No such file or directory
try 'C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe --help' for more information

enter image description here

Then trying with quotes

C:\Program Files\MongoDB\Server\3.6\bin> mongod --auth --dbpath /data/db --config "C:\Program Files\MongoDB\Server\3.6\mongod.cfg"

and getting:

2018-07-02T02:49:21.272+0300 I CONTROL [main] log file "c:\data\log\mongod.log" exists; moved to "c:\data\log\mongod.log.2018-07-01T23-49-21".

enter image description here Starting mongo, then show dbs and see: enter image description here

If I'm writting this snippet (without config), everything is fine:

mongod --auth --dbpath /data/db --bind_ip 127.0.0.1

enter image description here With mongo: enter image description here What I'm doing wrong? I appreciate any help.

Was it helpful?

Solution

Solution

  1. To avoid the error like: not master and slaveOk = false need always using the command: rs.slaveOk().
  2. To avoid typing rs.slaveOk() every time need to add rs.slaveOk() in .mongorc.js file check here and here
  3. More detail information.
Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top