UnderGreen / ansible-role-mongodb

Ansible role to configure MongoDB
GNU General Public License v2.0
343 stars 294 forks source link

Debian Stretch / MongoDB 4.0 - systemd unit file conflict #162

Closed TomaszUrugOlszewski closed 5 years ago

TomaszUrugOlszewski commented 5 years ago

Hello,

Systemd unit files are provided by Debian mongodb-org-server package, and there is no need to install another one using ansible.

Immediately after provisioning MongoDB 4.0, "mongod.service" is used, and "mongodb.service" is inactive. After server reboot, "mongodb.service" is used (or it was my pure luck). So we have small conflict here.

boutetnico commented 5 years ago

I can confirm this issue.

The difference between these files is mongodb.service is invoking mongod using numactl which is, in my understanding, the reason behind this custom systemd service file. This is a recommended setting from official MongoDB documentation.

I see few options to resolve this:

1) Disable mongod.service (might be error prone when restarting the service manually) 2) Delete mongod.service 3) Overwrite mongod.service with the template provided in this role 4) Same as 3) + Make installing NUMA & custom systemd unit file optional so one can disable that.

I would go for option 4 and could prepare a PR for that.

@UnderGreen @TomaszUrugOlszewski What do you think?

TomaszUrugOlszewski commented 5 years ago

Hello @boutetnico

As role user, I don't need custom MongoDB unit file, and one provided by package is good enough.

So another option that I would like to add:

  1. Specify additional variable that allows to overwrite service name (to "mongod.service") and disable uploading custom "mongodb.service" unit file. Ofc we still need custom unit file for "mongos"

If "5" is false, then option 4 looks like the best solution with custom MongoDB unit file.

UnderGreen commented 5 years ago

@TomaszUrugOlszewski can you check that the problem solved with latest master?