I am trying to set up MongoDB on Windows, and the online docs seem far from accurate.
Under \"Configure a Windows Service\" part, step 1 mentions to create a config file
For those who installed via *.msi installer and wondering where is .conf file located. Run 'services.msc' and check properties of mongodb service runnable file.
Here is my simple test MongoDB Config file for Windows. Note that I had to have 2 spaces before each property, e.g., path. When I had 3 spaces I got an error at startup.
I start the server with: mongod --config c:\tools\mongodb\db\mongod.cfg
systemLog:
destination: file
path: "C:\\tools\\mongodb\\db\\log\\mongo.log"
logAppend: true
storage:
dbPath: "C:\\tools\\mongodb\\db\\data"
security:
authorization: enabled
You can find logs with reasons why it's not working in log file. In your case, read P:\Servers\MongoDB\logs\mongodb.log file.
Here's an example of a mongodb.config file for Windows.
##store data here
dbpath=C:\mongodb\data\db
##all output go here
logpath=C:\mongodb\data\log\mongo.log
##log read and write operations
diaglog=3
check if you have any file in data\db path. Please remove all those files and try to restart. I exactly used your config file and able to start the service successfully with bindip and port
Bit late but I had the exact same issue today. If you use forward slashes for your paths within the config file it works fine.
systemLog:
destination: file
logAppend: true
path: "e:/mongo_data/3.6/mongo.log"
storage:
dbPath: "e:/mongo_data/3.6/db"
engine: "wiredTiger"