Skip to content

Commit

Permalink
Fix sysmtemd nofile limit
Browse files Browse the repository at this point in the history
  • Loading branch information
shortdudey123 committed Dec 8, 2015
1 parent bb2e0ce commit e6468d0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion recipes/configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 5 additions & 2 deletions recipes/sentinel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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!")
Expand Down
1 change: 1 addition & 0 deletions templates/default/redis-sentinel@.service
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions templates/default/redis@.service.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit e6468d0

Please sign in to comment.