diff --git a/recipes/configure.rb b/recipes/configure.rb index ef03136a..765759f0 100644 --- a/recipes/configure.rb +++ b/recipes/configure.rb @@ -36,7 +36,10 @@ template '/usr/lib/systemd/system/redis@.service' do source 'redis@.service.erb' - variables({ :bin_path => node['redisio']['bin_path'] }) + variables({ + :bin_path => node['redisio']['bin_path'], + :limit_nofile => redis['default_settings']['maxclients'] + 32 + }) only_if { node['redisio']['job_control'] == 'systemd' } end diff --git a/recipes/sentinel.rb b/recipes/sentinel.rb index 4c3ff193..0cdb6732 100644 --- a/recipes/sentinel.rb +++ b/recipes/sentinel.rb @@ -44,7 +44,10 @@ template '/usr/lib/systemd/system/redis-sentinel@.service' do source 'redis-sentinel@.service' - variables({ :bin_path => node['redisio']['bin_path'] }) + variables({ + :bin_path => node['redisio']['bin_path'], + :limit_nofile => redis['default_settings']['maxclients'] + 32 + }) only_if { node['redisio']['job_control'] == 'systemd' } end @@ -70,7 +73,7 @@ when 'systemd' service "redis-sentinel@#{sentinel_name}" do provider Chef::Provider::Service::Systemd - supports :start => true, :stop => true, :restart => true, :status => true + supports :start => true, :stop => true, :restart => true, :status => true end else Chef::Log.error("Unknown job control type, no service resource created!") diff --git a/templates/default/redis-sentinel@.service b/templates/default/redis-sentinel@.service index 5acdc221..0343d353 100644 --- a/templates/default/redis-sentinel@.service +++ b/templates/default/redis-sentinel@.service @@ -6,6 +6,7 @@ After=network.target ExecStart=<%= @bin_path %>/redis-server /etc/redis/sentinel_%i.conf --sentinel --daemonize no User=redis Group=redis +LimitNOFILE=<%= @limit_nofile %> [Install] WantedBy=multi-user.target diff --git a/templates/default/redis@.service.erb b/templates/default/redis@.service.erb index a4987abd..23066471 100644 --- a/templates/default/redis@.service.erb +++ b/templates/default/redis@.service.erb @@ -7,6 +7,7 @@ ExecStart=<%= @bin_path %>/redis-server /etc/redis/%i.conf --daemonize no ExecStop=/usr/bin/redis-shutdown User=redis Group=redis +LimitNOFILE=<%= @limit_nofile %> [Install] WantedBy=multi-user.target