asyncio redis cluster: fixed reconnection when whole cluster goes down#3111
asyncio redis cluster: fixed reconnection when whole cluster goes down#3111adaamz wants to merge 1 commit intoredis:masterfrom
Conversation
1c9a19f to
201b345
Compare
201b345 to
715cfcf
Compare
|
@chayim Hello, is there anything I can do to get this PR reviewed? Thanks |
715cfcf to
975b666
Compare
…n and then back online
975b666 to
de8144f
Compare
|
@petyaslavova but this doesn't solve my issue, or is it? When all nodes goes down then all nodes are removed fromt he list and when they are up again the list is still empty and we are unable to use those nodes again. |
|
@adaamz, you should instantiate your cluster with dynamic_startup_nodes=False. This ensures that the initial list of startup_nodes won't be overwritten by nodes discovered from the cluster, allowing the original addresses to remain available after a cluster recovery. |
|
@petyaslavova Thanks. What about in case we set one DNS node and then the library should discover rest of nodes in cluster? Will it discover whole cluster when connecting to only set node or it will just communicate just with the one configured node? |
@adaamz Yes, it will. And the nodes will be used for almost the whole communication. The only request that will be sent to the initial startup node/s is the one for cluster topology extraction. |
Pull Request check-list
Description of change
When redis cluster goes completely down (all nodes are offline) then redis-py library is unable to reconnect to them when at least startup nodes are back online.
This workaround worked for me, but I'm not sure if there is some more efficient way to achieve same bugfix.
I testesd it isolately with spawning minimal redis cluster in docker and then taking it down and up after few seconds to test how the app reacts on this.
My python test script looks like this: