Centos 7 systemctl times out

1,559 views
Skip to first unread message

bodomic

unread,
Apr 27, 2019, 2:45:32 PM4/27/19
to mongodb-user
Hello, I have a very silly question as I'm not too experienced in CentOS (even though have years of exp in deb linux).
Running on the freshly created CentOS AWS image with very simple config and official rpm does not return correctly to systemctl, so it kills mongodb process after timeout:
Apr 27 20:06:36 test systemd[1]: Starting MongoDB Database Server...
Apr 27 20:08:06 test systemd[1]: mongod.service start operation timed out. Terminating.
I've checked during these 90 seconds - mongodb itself works fine. I've tried turning off SELinux (just in case), but it did not help.
Please advise if anyone has similar experience.

Config looks like this:
storage:
  dbPath: /data/mongo
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log
net:
  port: 27017
  bindIp: localhost

processManagement:
  timeZoneInfo: /usr/share/zoneinfo



Amit Wankhede

unread,
Apr 27, 2019, 11:02:47 PM4/27/19
to mongod...@googlegroups.com
Which CentOS version it is? There could be some bug with systemctl to specific version.
Check other processes as well.

Regards 
Amit

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/a85a2e83-4f27-4bfb-b1bd-82eafe88f56a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mathew Robinson

unread,
Apr 29, 2019, 12:40:45 PM4/29/19
to bodomic, mongod...@googlegroups.com
Hey Bodomic,

This is because you have not specified that MongoDB should fork in your config file. Our systemd service file for RPM distress Type=forking for backwards compatibility reasons that Deb based distros did not have. You can fix your problem one of two ways:

Remove the Type=forking from the systemd service file. You can do this by using sudo systemctl edit mongod which will create an override service file in /etc/systemd/system.

Or you can add this to your config file:

processManagement:
  fork: true # fork and run in background
  pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
   timeZoneInfo: /usr/share/zoneinfo


Hope this helps!

- Mathew Robinson (chasinglogic)

Alexey Bursan

unread,
Apr 29, 2019, 1:00:16 PM4/29/19
to Mathew Robinson, mongod...@googlegroups.com
Perfect, thanks Mathew!
I have actually changed Type='forking' to 'oneshot' but this was also not correct - mongod service status has stayed 'activating' forever.
Your suggestion of doing forking correct way has worked perfectly!
This thread is successfully completed.

пн, 29 апр. 2019 г. в 19:40, Mathew Robinson <mathew....@10gen.com>:
Reply all
Reply to author
Forward
0 new messages