What does StackExchange.Redis do with the configured Masters/Slaves?

本小妞迷上赌 提交于 2019-12-10 10:17:54

问题


I'm looking at StackExchange.Redis and notice it has features for automatically determining which of the configured servers is master, and which are slaves.

I've not managed to spot what StackExchange actually does with the configured Masters/Slaves. Does it always run commands on Master, and only use configured Slaves for failover? Or is the answer more in-depth than that?

Any pointers appreciated!


回答1:


The key thing here is CommandFlags, a parameter on every method. By default, most are PreferMaster, however; note that write commands escalate to DemandMaster automatically. However, if you want to spread load, you can elect to push some read commands (preferably the expensive ones) to slaves via PreferSlave and DemandSlave.

The other things it let's you do is to switch master (promote to master) - although this is naturally more invasive.



来源:https://stackoverflow.com/questions/30595536/what-does-stackexchange-redis-do-with-the-configured-masters-slaves

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!