DEV Community

nik
nik

Posted on

node js client hangs on connection to redis cluster when master changes

Hi All! I have a Redis Cluster with three master shards. Each Master Shard node has one replica. The client on node.js connects to the cluster and sends requests at 500 requests per second.
When one Master fails and the Master on the replica changes, i.e. the structure of the classer changes, the node.js client stops and hangs endlessly without any error messages.
If I stop the node.js client and start it again, it reads the changed cluster structure and works fine.
My question is what needs to be added to the node.js client code (timeout or something else) so that when the cluster structure changes, node.js client itself reconnects to the cluster without restarting. Thanks in advance.

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay