2014年12月16日 星期二

[linux][redis](error) ERR max number of clients reached


127.0.0.1:6379> llen logimport
(error) ERR max number of clients reached


Maximum number of clients

In Redis 2.4 there was an hard-coded limit about the maximum number of clients that was possible to handle simultaneously.
In Redis 2.6 this limit is dynamic: by default is set to 10000 clients, unless otherwise stated by the maxmemory directive in Redis.conf.
However Redis checks with the kernel what is the maximum number of file descriptors that we are able to open (the soft limit is checked), if the limit is smaller than the maximum number of clients we want to handle, plus 32 (that is the number of file descriptors Redis reserves for internal uses), then the number of maximum clients is modified by Redis to match the amount of clients we are really able to handle under the current operating system limit.
When the configured number of maximum clients can not be honored, the condition is logged at startup as in the following example:
$ ./redis-server --maxclients 100000
[41422] 23 Jan 11:28:33.179 # Unable to set the max number of files limit to 100032 (Invalid argument), setting the max clients configuration to 10112.
When Redis is configured in order to handle a specific number of clients it is a good idea to make sure that the operating system limit to the maximum number of file descriptors per process is also set accordingly.
Under Linux these limits can be set both in the current session and as a system-wide setting with the following commands:
  • ulimit -Sn 100000 # This will only work if hard limit is big enough.
  • sysctl -w fs.file-max=100000

redis报-ERR max number of clients reached错误 – 酷喃|coolnull|

沒有留言:

張貼留言