From 0a0988ccc2f3c865631717f257d8a08bc582d9a6 Mon Sep 17 00:00:00 2001 From: Vincent Tamet Date: Thu, 24 Oct 2019 18:16:27 +0200 Subject: [PATCH 1/2] sentinel: systemd LimitNOFILE - sysctl net.core.somaxconn --- manifests/sentinel.pp | 12 +++++++++++- templates/systemd/sentinel.service.erb | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/manifests/sentinel.pp b/manifests/sentinel.pp index 1bead19..9de9f19 100644 --- a/manifests/sentinel.pp +++ b/manifests/sentinel.pp @@ -73,6 +73,8 @@ $running = true, $enabled = true, $manage_logrotate = true, + $sentinel_maxopenfiles = 12288, + $sentinel_somaxconn = 1024, ) { $sentinel_user = $::redis::install::redis_user $sentinel_group = $::redis::install::redis_group @@ -159,13 +161,21 @@ } } + exec { 'sysctl_sentinel': + command => "sysctl -w net.core.somaxconn=${sentinel_somaxconn}", + path => '/usr/bin:/usr/sbin:/bin', + provider => shell, + onlyif => "test `sysctl -n net.core.somaxconn` -lt ${sentinel_somaxconn}", + } + # manage sentinel service service { "redis-sentinel_${sentinel_name}": ensure => $running, enable => $enabled, hasstatus => true, hasrestart => true, - subscribe => File[$conf_file], + require => Exec['sysctl_sentinel'], + subscribe => [File[$conf_file],Exec['sysctl_sentinel']], } if ($manage_logrotate == true){ diff --git a/templates/systemd/sentinel.service.erb b/templates/systemd/sentinel.service.erb index 97a1213..59ab292 100644 --- a/templates/systemd/sentinel.service.erb +++ b/templates/systemd/sentinel.service.erb @@ -16,6 +16,7 @@ ExecStart=/usr/bin/redis-sentinel <%= @sentinel_run_dir %>/<%= @conf_file_name ExecStop=/usr/bin/redis-cli -p <%= @sentinel_port %> shutdown User=<%= @sentinel_user or 'root' %> Group=<%= @sentinel_group or 'root' %> +LimitNOFILE=<%= @sentinel_maxopenfiles %> [Install] WantedBy=multi-user.target From fce3c27a84e75dd9c70938aa6aff2b16279aee7d Mon Sep 17 00:00:00 2001 From: Vincent Tamet Date: Thu, 24 Oct 2019 18:29:18 +0200 Subject: [PATCH 2/2] sentinel: README for systemd LimitNOFILE - sysctl net.core.somaxconn --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index c48f313..43ec997 100644 --- a/README.md +++ b/README.md @@ -552,6 +552,12 @@ run with redis 2.8 or later. Configure logrotate rules for redis server. Default: true +##### `sentinel_maxopenfiles` +Systemd LimitNOFILE change to allow sentinel change maxclients. Default: 12288 + +##### `sentinel_somaxconn` +Sysctl change to allow sentinel change TCP backlog. Default: 1024 + ## Limitations This module is tested on CentOS 6.5 and Debian 7 (Wheezy) and should also run without problems on