I’am using aws elastiCache for redis in cluster mode in my project .
I’v used key space notification feature of redis to listen for particular expiry event.It works fine without clustering .But after clustering, I’m unable to get message in subscribe block.
subscribe(`__keyevent@0__:expired`);
redis keyspace notification aws elastiCache for redis
2
Answers
use parameter group in aws to set config and pass the keys in it.
Make sure you are listening on all nodes
From the manual…
Every node of a Redis cluster generates events about its own subset of the keyspace as described above. However, unlike regular Pub/Sub communication in a cluster, events’ notifications are not broadcasted to all nodes. Put differently, keyspace events are node-specific. This means that to receive all keyspace events of a cluster, clients need to subscribe to each of the nodes.