skip to Main Content

I’m using redis with docker, and i have currently this error :

[ioredis] Unhandled error event: ReplyError: ERR max number of clients reached

Someone could help me ?

Thank you

2

Answers


  1. Redis will accept a maximum number of connections. This error is Redis stating it has reached that limit. You can adjust this value in your redis.conf file.

    That said, I usually see this when folks are connecting to Redis in a loop or in some sort of event and then don’t close the connection when they are done. You can do this by calling .quit from ioredis.

    Login or Signup to reply.
  2. In your redis.conf file there is a configuration:

    maxclients 10000
    

    This means that a maximum of 10K clients can connect to Redis at once.

    Generally, this limit is enough and the problem lies on the client side who are opening the connection, doing some operation but not closing the connection when the work is done.
    Or if you have some kind of looping logic in your client and you are initializing the connection inside the loop, thus opening multiple connections.

    One last thing to keep in mind is, setting

    maxclients 10000
    

    does not gurantee that 10K clients will be able to connect to Redis. If redis server is not able to configure the process file limit to 10K, the maxclients is set to current file limit minus 32

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search