0

Using CentOS 7. Used yum install mongodb-org

If I change the dbPath in /etc/mongod.conf it is not working when I start the mongod with systemctl start mongod.service. However if I start like mongod --dbpath /new/folder it is working fine.

In the documentation (https://docs.mongodb.com/manual/reference/configuration-options/) it is given that

The Linux package init scripts do not expect storage.dbPath to change from the defaults. If you use the Linux packages and change storage.dbPath, you will have to use your own init scripts and disable the built-in scripts.

How to change the default init scripts?

I have gone through Changing MongoDB data store directory Moving MongoDB's data folder? how to set mongod --dbpath

Dominic
  • 77
  • 10

1 Answers1

0

You can try to remove your service, restart your computer, then create a new service with mongod option --dbpath : systemctl enable mongod.service. It should work !

Kubadev
  • 867
  • 10
  • 25