Skip to content

Instantly share code, notes, and snippets.

@pgbezerra
Last active April 9, 2020 02:54
Show Gist options
  • Save pgbezerra/98016c2a89126c59bca3260e07bbdc44 to your computer and use it in GitHub Desktop.
Save pgbezerra/98016c2a89126c59bca3260e07bbdc44 to your computer and use it in GitHub Desktop.
Systemd mongod mongos scripts
[Unit]
Description=High-performance, schema-free document-oriented database
After=syslog.target
After=network.target
[Service]
User=mongodb
Group=mongodb
Type=forking
RuntimeDirectory=mongodb
RuntimeDirectoryMode=755
PIDFile=/var/run/mongodb/mongos.pid
ExecStart=/usr/bin/mongod --quiet \
--config /etc/mongod.conf \
--pidfilepath /var/run/mongodb/mongod.pid \
--fork
LimitFSIZE=infinity
LimitCPU=infinity
LimitAS=infinity
LimitNOFILE=64000
LimitNPROC=64000
[Install]
WantedBy=multi-user.target
[Unit]
Description=High-performance, schema-free document-oriented database
After=syslog.target
After=network.target
[Service]
User=mongodb
Group=mongodb
Type=forking
RuntimeDirectory=mongodb
RuntimeDirectoryMode=755
PIDFile=/var/run/mongodb/mongos.pid
ExecStart=/usr/bin/mongos --quiet \
--config /etc/mongos.conf \
--pidfilepath /var/run/mongodb/mongos.pid \
--fork
LimitFSIZE=infinity
LimitCPU=infinity
LimitAS=infinity
LimitNOFILE=64000
LimitNPROC=64000
[Install]
WantedBy=multi-user.target
@mohag
Copy link

mohag commented Jan 31, 2020

Type=simple and skipping --fork off should work as well (and is closer to the mongod.service in the official packages

@pgbezerra
Copy link
Author

Great, thank you @mohag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment