Can not start mongod with systemctl if change pidFilePath
Description
Environment
Attachments
Activity

Konstantin Trushin April 21, 2022 at 10:33 AM
Resolving for now. Please reopen in case of any questions.

Konstantin Trushin April 6, 2022 at 1:55 PM
Hello ,
thank you for the confirmation and sorry for the delay in response.
I looked into how the pid file is managed and has discovered the way to change the path to it (requires root privileges):
stop the service with
systemctl stop mongod
change the value of
pidFilePath
in/etc/mongod.conf
to the new pathchange the value of
PIDFile
in/lib/systemd/system/mongod.service
to the new pathreplace all two instances of
/var/run/mongod.pid
with the new path in/usr/bin/percona-server-mongodb-helper.sh
ensure the
mongod
user has write permissions to the parent directory of the new pathrun
systemctl daemon-reload
start the service with
systemctl start mongod
Could you please confirm that the described recipe works for you?
Regards,
Konstantin.

long ge March 30, 2022 at 3:00 AM
thank you for replying.
Yes, as you said, mongod can start successfully if using original value of pidFilePath. And I also check your mongodb documention, the value of pidFilePath in /etc/mongod.conf and in mongodb system unit file should be the same.
How wonderful if i can change pid path in /etc/mongo.conf and it work correctly the same as dbPath and systemLog!

Konstantin Trushin March 29, 2022 at 4:46 PM
Hello ,
Please correct me if I'm wrong but there isn't any message in the log you provided that seems to be related to pidFilePath
config parameter. Could you please confirm that restoring original value of pidFilePath
solves the issue?
Thanks,
Konstantin.
Reproduce:
1.change pidFilePath to another dirctory in /etc/mongod.conf after installing Percona Server for MongoDB rpm by yum;
eg. pidFilePath: /data/mongodb/mongod.pid
2. start mongod by "sudo systemctl start mongod" and check logs
Results:
1.start failed: