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

Sysctl systemd changes #147

Open
wants to merge 5 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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,14 @@ Default: empty

Configure logrotate rules for redis server. Default: true

##### `redis_maxopenfiles`

Systemd LimitNOFILE change to allow redis change maxclients. Default: 12288

##### `redis_somaxconn`

Sysctl change to allow redis change TCP backlog. Default: 1024

##### High Availability Options

##### `slaveof`
Expand Down
13 changes: 11 additions & 2 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@
$cluster_require_full_coverage = true,
$protected_mode = undef,
$include = [],
$redis_maxopenfiles = 12288,
$redis_somaxconn = 1024,
) {
include redis::install

Expand Down Expand Up @@ -288,13 +290,20 @@
}
}

exec { 'sysctl_redis':
command => "sysctl -w net.core.somaxconn=${redis_somaxconn}",
path => '/usr/bin:/usr/sbin:/bin',
provider => shell,
onlyif => "test `sysctl -n net.core.somaxconn` -lt ${redis_somaxconn}",
}

# manage redis service
service { "redis-server_${redis_name}":
ensure => $running,
enable => $enabled,
hasstatus => true,
hasrestart => true,
require => File[$service_file],
subscribe => File[$conf_file],
require => [File[$service_file],Exec['sysctl_redis']],
subscribe => [File[$conf_file],Exec['sysctl_redis']],
}
}
1 change: 1 addition & 0 deletions templates/systemd/redis.service.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ExecStart=/usr/bin/redis-server <%= @redis_run_dir %>/<%= @conf_file_name %> --d
ExecStop=/usr/bin/redis-cli -p <%= @redis_port %> shutdown
User=<%= @redis_user or 'root' %>
Group=<%= @redis_group or 'root' %>
LimitNOFILE=<%= @redis_maxopenfiles %>

[Install]
WantedBy=multi-user.target