0

When starting redis 3.0.6 (installed from jessie-backports) under Debian 8.4 jessie, I get the following warning/error:

18127:M 13 Apr 15:12:38.730 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
18127:M 13 Apr 15:12:38.730 # Redis can't set maximum open files to 10032 because of OS error: Operation not permitted.
18127:M 13 Apr 15:12:38.730 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.

When running ulimit -n as root I get:

65536

The open file limit for the redis user:

$ ps -u redis
PID TTY          TIME CMD
18127 ?        00:00:00 redis-server
$ sudo grep 'open files' /proc/18127/limits
Max open files            4096                 4096                 files

How do I increase the open files limit for the redis user, so it can set the appropriate limit for the maxclients setting? I tried editing /etc/security/limits.conf and sysctl -w fs.file-max=2459017, but none really worked for the redis user.

2
  • how did you install redis? (debian package, compiled source from redis.io ...), what are those 'some things' you tried?
    – mrc
    Apr 13, 2016 at 13:27
  • Installed it directly from jessie-backports, clarified the things I have tried in the question.
    – tholu
    Apr 13, 2016 at 13:30

1 Answer 1

4

limits.conf does not apply to systemd services (https://bugzilla.redhat.com/show_bug.cgi?id=754285)

so you should:

  1. edit /lib/systemd/system/redis-server.service and add to the [Service] section the line (after: User=redis and Group=redis) LimitNOFILE=65536

  2. run: systemctl daemon-reload && systemctl restart redis-server

and ... it should get the new limit

check: https://sskaje.me/systemd-ulimit/

good luck!

1
  • Thank you, that worked! I actually also tried that before, but added the line right after [Service], where it did not work (or I made another mistake).
    – tholu
    Apr 13, 2016 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.