Setting up MongoDB service on systemd

997 views
Skip to first unread message

Sicabol

unread,
Nov 14, 2016, 12:15:40 PM11/14/16
to mongodb-user
Hi,

I've installed mongod on an Ubuntu 16.04LTS. By default, systemd is used. What is great with the Ubuntu package is that the systemd service is already set… but apparently the "ulimit" section doesn't work. Here is the mongod.service file content :

[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
Documentation=https://docs.mongodb.org/manual

[Service]
User=mongodb
Group=mongodb
ExecStart=/usr/bin/numactl --interleave=all /usr/bin/mongod --quiet --config /etc/mongod.conf
LimitFSIZE=infinity # file size
LimitCPU=infinity # cpu time
LimitAS=infinity # virtual memory size
LimitNOFILE=64000 # open files
LimitNPROC=64000 # processes/threads
TasksMax=infinity # total threads (user+kernel)
TasksAccounting=false
# Recommended limits for for mongod as specified in
# http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings

[Install]
WantedBy=multi-user.target

As you can see I have modified ExecStart to be sure to launch numactl before mongod - a necessity according to the mongo shell. Everything seems to work fine, except that cloud.mongodb.org shows a warning for this server :

Process has low open files limit.

The server on which this process is running has a low open files limit. Please see MongoDB Documentation for more details.


The documentation page tells to update the Limit… lines, exactly as they already are.

Can someone give me a hint about this issue ? Thanks !

Rodrigo Nascimento

unread,
Nov 14, 2016, 5:59:32 PM11/14/16
to mongodb-user
Hi Sicabol,

RHEL or CENTOS I solved this issue editing this file /etc/security/limits.d/20-nproc.conf:

# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.

*          soft    nproc     4096
root       soft    nproc     unlimited
mongod   soft    nproc     64000


I hope it helps you.

All the best,

Logwriter
Reply all
Reply to author
Forward
0 new messages