diff options
author | 2017-01-11 13:56:57 -0500 | |
---|---|---|
committer | 2017-04-03 15:17:54 +0000 | |
commit | 3aa86a4ea3c2406f79d6283cbb158f67136b5e9a (patch) | |
tree | 10aea6b674be67f6f7b20596b7439c2de632d6c0 /manifests/profile/base | |
parent | e2928717412242faa4eb15d778f1b5c0952edc08 (diff) |
Restrict mongodb memory usage
Currently, mongodb has no limits on how much memory
it can consume. This enforces restriction so mongodb
service limits through systemd.
The puppet-systemd module has support for limits. The
MemoryLimit support is added in the follwoing pull
request https://github.com/camptocamp/puppet-systemd/pull/23
Closes-bug: #1656558
Change-Id: Ie9391aa39532507c5de8dd668a70d5b66e17c891
Diffstat (limited to 'manifests/profile/base')
-rw-r--r-- | manifests/profile/base/database/mongodb.pp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/manifests/profile/base/database/mongodb.pp b/manifests/profile/base/database/mongodb.pp index 8967f5b..4740d67 100644 --- a/manifests/profile/base/database/mongodb.pp +++ b/manifests/profile/base/database/mongodb.pp @@ -30,10 +30,15 @@ # for more details. # Defaults to hiera('step') # +# [*memory_limit*] +# (Optional) Limit amount of memory mongodb can use +# Defaults to 20G +# class tripleo::profile::base::database::mongodb ( $mongodb_replset, $bootstrap_node = downcase(hiera('bootstrap_nodeid')), $step = hiera('step'), + $memory_limit = '20G', ) { if $step >= 2 { @@ -56,5 +61,11 @@ class tripleo::profile::base::database::mongodb ( } } + # Limit memory utilization + ::systemd::service_limits { 'mongod.service': + limits => { + 'MemoryLimit' => $memory_limit + } + } } } |