Ioredis: sentinel mode failover by hand, how can ioredis know

Created on 14 May 2016  Â·  5Comments  Â·  Source: luin/ioredis

If i use sentinel mode, and connected with host1 (master node), and then I exec a failover cmd on a sentinel node. In this condition, my client will get a READONLY ERROR when i still write host1.
Should I check this error in another way or does ioredis support?

Most helpful comment

ioredis should be able to handle the failover so you don't have to. When a failover happens, Redis will disconnect all the clients that connected to the old master and the new master, so ioredis will ask the sentinel servers again for the new master node. Didn't it work for you?

All 5 comments

ioredis should be able to handle the failover so you don't have to. When a failover happens, Redis will disconnect all the clients that connected to the old master and the new master, so ioredis will ask the sentinel servers again for the new master node. Didn't it work for you?

I know what you mean. But what I said is faillover by hand, connection between client and redis master is alive and how client know?

No matter what causing the failover, as I said, Redis always disconnects all clients so that clients are able to know whether a failover happens. Refer to http://redis.io/topics/sentinel-clients#sentinel-failover-disconnection for details.

Ok, get it. Thanks !

Becarefull, according to http://redis.io/topics/sentinel-clients#sentinel-failover-disconnection, Sentinel failover disconnection require at least Redis 2.8.12(ioredis already point out in the documention), if you use low redis versions(like me 2.8.7), application will broken after redis failover.

I already use "reconnectOnError" options to force reconnect if READONLY, and ask op to upgrade redis.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ORESoftware picture ORESoftware  Â·  5Comments

jehy picture jehy  Â·  4Comments

lakano picture lakano  Â·  3Comments

jamesdixon picture jamesdixon  Â·  4Comments

luckyscript picture luckyscript  Â·  5Comments