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
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
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".
Starting mongo
, then show dbs
and see:
If I'm writting this snippet (without config), everything is fine:
mongod --auth --dbpath /data/db --bind_ip 127.0.0.1
Best Answer
Solution
not master and slaveOk = false
need always using the command:rs.slaveOk()
.rs.slaveOk()
in.mongorc.js
file check here and here