Fix systemd unit file for mongodb and add manage limits.

This commit is contained in:
Mikhail Konyakhin 2019-11-25 14:23:54 +03:00
parent b842529d7b
commit 0b50bcc867
3 changed files with 8 additions and 5 deletions

View File

@ -16,6 +16,8 @@ mongodb_pymongo_pip_version: 3.7.1
mongodb_user_update_password: "on_create" # MongoDB user password update default policy
mongodb_manage_service: true
mongodb_manage_systemd_unit: true
mongodb_systemd_unit_limit_nofile: 64000
mongodb_systemd_unit_limit_nproc: 64000
mongodb_disable_transparent_hugepages: false

View File

@ -59,8 +59,8 @@
state: present
- name: Add systemd configuration if present
copy:
src: mongodb.service
template:
src: mongodb.service.j2
dest: "/lib/systemd/system/{{mongodb_daemon_name}}.service"
owner: root
group: root

View File

@ -1,9 +1,10 @@
# {{ ansible_managed }}
[Unit]
Description=An object/document-oriented database
Documentation=man:mongod(1)
[Service]
User=mongodb
User={{ mongodb_user }}
ExecStart=/usr/bin/numactl --interleave=all /usr/bin/mongod --config /etc/mongod.conf
# file size
LimitFSIZE=infinity
@ -12,9 +13,9 @@ LimitCPU=infinity
# virtual memory size
LimitAS=infinity
# open files
LimitNOFILE=64000
LimitNOFILE={{ mongodb_systemd_unit_limit_nofile }}
# processes/threads
LimitNPROC=64000
LimitNPROC={{ mongodb_systemd_unit_limit_nproc }}
# locked memory
LimitMEMLOCK=infinity
# total threads (user+kernel)