redis server error: Failed to connect to redis: Cannot assign requested address

More and more often there is an error in the redis server log:

Failed to connect to redis: Cannot assign requested address

How to detect the cause of the occurrence?

Redis 4.0.6, debian 9.3

Author: LV426, 2019-01-15

1 answers

Solution

On the client server that connects to the redis server, there were too many connections in the status TIME-WAIT, more than 60k.

Find out the current number of connections grouped by status:

ss -tan | awk '{print $1}' | sort | uniq -c

Adding on the server client helped:

net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1

In the config /etc/sysctl.conf

Then sysctl -p to apply the changes.

It should be taken into account that the port limit can also be on the redis server itself. It is checked and treated accurately also.

 2
Author: LV426, 2019-01-27 10:15:58