Mongod -f mongod.conf

Hi, I’m new to mongodb, I’ve downloaded and installed the community version for windows, running mongod works just fine, but when I try to run mongod with a configuration file “mongod.conf” via mongod -f mongod.conf nothing happens, I get a blinking cursor.
Below is my config file info

net:
  port: 27001
  bindIp: 127.0.0.1
security:
  authorization: enabled
systemLog:
  logAppend: true
  path:  var/mongodb/node/mongod.log
  destination: file
storage:
  dbPath:  var/db

However if I remove the systemLog info the code works, what’s going on? I ensured var/mongodb/node is created and has read write permission

Can someone help me explain why this ain’t working when my systemLog info is added to my config file

Is this path correct for a Windows server?
Can you cd to var/mongodb/node
Always give full path(absolute).What you have given is a relative path
When you remove logpath it works because it starts mongod without logfile
When you run just mongod also it works because it uses default port/dirpath

1 Like

Hi,
here is my new configuration file:

systemLog:
logAppend: true
destination: file
path: “C:/Program Files/MongoDB/Server/5.0/log1/mongod1.log”

net:
bindIp: 127.0.0.1
port: 27000
security:
authorization: enabled
storage:
dbPath: var/mongodb/db

getting this error:

$ mongod -f mongod.conf
{“t”:{"$date":“2022-04-12T06:50:49.765Z”},“s”:“F”, “c”:“CONTROL”, “id”:20574, “ctx”:"-",“msg”:“Error during global initialization”,“attr”:{“error”:{“code”:38,“codeName”:“FileNotOpen”,“errmsg”:“Can’t initialize rotatable log file :: caused by :: Failed to open C:/Program Files/MongoDB/Server/5.0/log1/mongod1.log”}}}

It says failed to open file.Does the dir exist?Can mongod write to that dir?
Your dbpath is still not correct

I feel my dbpath is correct and my dir exist, although I stand to be corrected because the mongod1.log file was created with some log information in it.

The only challenge here is that mongod does not start, the cursor only freezes on start up using mongod -f mongod.conf

It will be backward slash on Windows but your path shows all forward slash
What does it show in mongod.log?
You can give new name to logfile to avoid any confusion in reading older messages