From c485b379377677832c44deb2e922a59f756010a7 Mon Sep 17 00:00:00 2001 From: Damien Ciabrini Date: Wed, 21 Oct 2020 17:36:29 +0200 Subject: [PATCH] [queens only] mysql: make nproc limit configurable Docker image for mysql inherits a nproc limit from the CentOS 7 base image, which results in the mysqld process being limited to 4096 processes, which can be a problem. Expose a new parameter mysql_nproc_limit in puppet, to allow overriding that limit in hiera if needed. Change-Id: I99a771c93bb44f62124b2b44cdddc883ce01fd17 Co-Authored-By: Michele Baldessari Closes-Bug: #1900864 --- manifests/profile/base/database/mysql.pp | 14 ++++++++++++++ templates/mysql/limits.conf | 2 ++ 2 files changed, 16 insertions(+) create mode 100644 templates/mysql/limits.conf diff --git a/manifests/profile/base/database/mysql.pp b/manifests/profile/base/database/mysql.pp index f3b06ef02..ac3b5be55 100644 --- a/manifests/profile/base/database/mysql.pp +++ b/manifests/profile/base/database/mysql.pp @@ -87,6 +87,10 @@ # (Optional) Maximum number of connections to MySQL. # Defaults to hiera('mysql_max_connections', undef) # +# [*mysql_nproc_limit*] +# (Optional) Maximum nproc limit in PAM for mysqld. +# Defaults to undef +# # [*remove_default_accounts*] # (Optional) Whether or not remove default MySQL accounts. # Defaults to true @@ -112,6 +116,7 @@ class tripleo::profile::base::database::mysql ( $manage_resources = true, $mysql_server_options = {}, $mysql_max_connections = hiera('mysql_max_connections', undef), + $mysql_nproc_limit = undef, $remove_default_accounts = true, $step = Integer(hiera('step')), ) { @@ -138,6 +143,15 @@ class tripleo::profile::base::database::mysql ( $tls_cipher_list = undef } + if $mysql_nproc_limit { + file { '/etc/security/limits.d/99-mysqld.conf': + content => template('tripleo/mysql/limits.conf'), + owner => '0', + group => '0', + mode => '0644', + } + } + # non-ha scenario if $manage_resources { $mysql_step = 2 diff --git a/templates/mysql/limits.conf b/templates/mysql/limits.conf new file mode 100644 index 000000000..9668f4c53 --- /dev/null +++ b/templates/mysql/limits.conf @@ -0,0 +1,2 @@ +mysql soft nproc <%= @mysql_nproc_limit %> +mysql hard nproc <%= @mysql_nproc_limit %>