[SERVER-23830] On RHEL7/Centos7 mongod can't stop if pid location in conf differs from the init.d script Created: 20/Apr/16 Updated: 23/Nov/16 Resolved: 13/Jul/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Admin |
| Affects Version/s: | None |
| Fix Version/s: | 3.0.13, 3.2.9, 3.3.10 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Davenson Lombard | Assignee: | Ernie Hershey |
| Resolution: | Done | Votes: | 1 |
| Labels: | code-only | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||
| Backport Completed: | |||||||||||||
| Sprint: | Build 15 (06/03/16), Build 16 (06/24/16), Build 17 (07/15/16) | ||||||||||||
| Participants: | |||||||||||||
| Description |
|
In Centos 7.2 (did not test on other versions), if we modify the pidfilepath in the mongod.conf, the mongod service cannot be stopped. The solution was to change the pidfilepath in the /etc/init.d/mongod file. Steps to reproduce the issue
Solution
Thank you, Davenson Lombard |
| Comments |
| Comment by Githook User [ 13/Jul/16 ] |
|
Author: {u'username': u'ehershey', u'name': u'Ernie Hershey', u'email': u'ernie.hershey@10gen.com'}Message: This is a small change, the only affect of which is that systemd's (cherry picked from commit b68339f58d1168569ac46e8749429dd26e73748f) |
| Comment by Githook User [ 13/Jul/16 ] |
|
Author: {u'username': u'ehershey', u'name': u'Ernie Hershey', u'email': u'ernie.hershey@10gen.com'}Message: This is a small change, the only affect of which is that systemd's (cherry picked from commit b68339f58d1168569ac46e8749429dd26e73748f) |
| Comment by Githook User [ 13/Jul/16 ] |
|
Author: {u'username': u'ehershey', u'name': u'Ernie Hershey', u'email': u'ernie.hershey@10gen.com'}Message: This is a small change, the only affect of which is that systemd's |
| Comment by Ernie Hershey [ 24/Jun/16 ] |
|
if I remove that line, the following works:
This does not work, but I don't think it doesn't on any system -
I'm going to test a bit more and try to determine if these header comments are used for anything. |
| Comment by Ernie Hershey [ 22/Jun/16 ] |
|
If I remove the "# pidfile" comment in the init script, I have better luck in systemd with a modifed /etc/mongod.conf. I can see that systemctl tends to generally automatically update /run/systemd/generator.late/mongod.service to match the comment header contents of /etc/mongod.conf, with or without the pidfile comment, more or less every time I run it. I'm going to try more testing without the line in the init script and make sure other things still work as expected. If that's the only fix, it's pleasantly small and simple. |
| Comment by Ernie Hershey [ 19/May/16 ] |
|
Some additional docs on how this works. Maybe there's a way to re-generate the compatibility service systemd is using and have it pick up the new pid file path - http://unix.stackexchange.com/questions/233468/how-does-systemd-use-etc-init-d-scripts |
| Comment by Ramon Fernandez Marina [ 18/May/16 ] |
|
Looks like systemd indeed parses the init script to find pidfile. If I change both pidFilePath in /etc/mongod.conf and pidfile in /etc/init.d/mongod then things work as expected. |
| Comment by Ernie Hershey [ 20/Apr/16 ] |
|
Hi - can you let me know what version of mongodb you're using? Also can you post your modified mongod.conf? This line in the init script should be picking up the pid file path from your config file. |