Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

sentinel: systemd LimitNOFILE - sysctl net.core.somaxconn #146

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion manifests/sentinel.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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){
Expand Down
1 change: 1 addition & 0 deletions templates/systemd/sentinel.service.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down