Reputation: 6450
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
With
mongo
:
What I'm doing wrong? I appreciate any help.
Upvotes: 0
Views: 1777
Reputation: 6450
Solution
Thanks to recomendation by Ansgar, I solved it.
not master and slaveOk = false
need always using the command: rs.slaveOk()
. rs.slaveOk()
every time need to add rs.slaveOk()
in .mongorc.js
file check here and hereUpvotes: 0