0

I have installed MongoDB using manual option.

When I fire mongod it will take parameters from somewhere else specially for dbPath.

I want to have my own dbPath without specifying it with --dbPath each time.

So I found option to provide mongod.conf file and call mongod --config option but still I need to pass path of .conf file.

My ultimate goal is to just launch mongod as service and it will read config file from path I configured. For this I tried LaunchAgent and LaunchDaemon with no luck. What I thought is that if I can configure LaunchAgent or Daemon then I will provide path to mongod of bin directory of MongoDB folder and provide --config and path for .conf file as argument and then I need to just launch mongod using launchctl with name mongod and it will start mongod --config <.conf file path>.

But I am not able to do so. I read nearly 15-16 posts on LaunchAgent and Daemon but did not get solution my problem. I tried to do so with making mongod.plist file at various places like /Library/LaunchDaemon, /Library/LaunchAgent and ~/Library/LaunchDaemon but I always get error "Path had bad ownership/permissions". I tried chown and chgrp but no luck.

I hope you got my point. I really need complete solution to achieve my goal.

Lycos IUT
  • 158
  • 7
Premal
  • 551
  • 1
  • 6
  • 25

1 Answers1

0

Do you use linux or windows? This is the default location of mongodb.conf in linux:

/etc/mongodb.conf

You can simply edit it with your parameters, and start the service using:

sudo service mongodb restart

If you are using windows, it depends on the version of MongoDB you are using, but check in:

C:\Program Files\MongoDB\Server\3.4\...

For the same file.

Some1Else
  • 489
  • 2
  • 6