MongoDB setup on NUMA machine

centos7mongodb

I installed MongoDB 3.6 on my centos 7 machine and in the startup log I see a warning because I am running NUMA hardware:

2018-02-05T00:13:23.889+0100 I CONTROL  [initandlisten] ** WARNING: You are running on a NUMA machine.
2018-02-05T00:13:23.889+0100 I CONTROL  [initandlisten] **          We suggest launching mongod like this to avoid performance problems:
2018-02-05T00:13:23.889+0100 I CONTROL  [initandlisten] **              numactl --interleave=all mongod [other options]

I wonder how I could permanently fix this numactl startup as I don't want to start mongod manually every time. I usually run sudo service mongod start and I want that this command starts MongoDB every time with the numctl prefix.

How can I achieve this with CentOS7? (I googled and couldn't find any service files I could edit on my server).

Best Answer

On mine using CentOS 7.6 is at

/etc/systemd/system/multi-user.target.wants/mongod.service