Redis failed to set maxclients

A novice learns a single machine redis, and the search engine finds out to set it in redis.conf

maxclients 10000

restart the redis/ server and use the time log file to prompt

You requested maxclients of 10000 requiring at least 10032 max file
descriptors. Redis can"t set maximum open files to 10032 because of OS
error: Operation not permitted. Current maximum open files is 4096.
maxclients has been reduced to 4064 to compensate for low ulimit. If
you need higher maxclients increase "ulimit-nasty.

redis-clie link

enter

config get maxclients

clipboard.png

ERR The operating system is not able to handle the specified number ofclients, try with 4064

ulimit -n 65535

clipboard.png

now ask why, how to successfully set maxclients to a large number?

Thank you ~

Jun.17,2022

solved it by itself, because the system is ubuntu 16, and the search engines are all 14 solutions

/etc/systemd/system/redis.service
[Service]
...
User=redis
Group=redis
-sharp should be fine as long as you add it under [Service] block
LimitNOFILE=65536
...

then

sudo systemctl daemon-reload
sudo systemctl restart redis.service

then

cat /run/redis/redis-server.pid
cat /proc/PID/limits

see
Max open files
Max locked memory
the number has become larger

the solution comes from

https://stackoverflow.com/que...

Menu