Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sentinel mode failover by hand, how can ioredis know #305

Closed
hzxuzhonghu opened this issue May 14, 2016 · 5 comments

Comments

@hzxuzhonghu
Copy link

commented May 14, 2016

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?

@luin

This comment has been minimized.

Copy link
Owner

commented May 14, 2016

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?

@hzxuzhonghu

This comment has been minimized.

Copy link
Author

commented May 16, 2016

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?

@luin

This comment has been minimized.

Copy link
Owner

commented May 16, 2016

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.

@hzxuzhonghu

This comment has been minimized.

Copy link
Author

commented May 16, 2016

Ok, get it. Thanks !

@luin luin closed this May 16, 2016

@tangxinfa

This comment has been minimized.

Copy link

commented Dec 23, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.