这是什么StackExchange.Redis做配置的主站/从站? [英] What does StackExchange.Redis do with the configured Masters/Slaves?
问题描述
我看StackExchange.Redis并注意它具有自动确定其配置的服务器是主功能,哪些是奴隶。
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.
我已经不设法找出什么StackExchange实际确实的与配置的主站/从站。它总是在主运行命令,并只使用配置的从站故障转移?或者是答案更深入的比?
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?
任何指针感激!
推荐答案
这里的关键是的commandflags
,在每个方法的参数。默认情况下,大多数是 PreferMaster
,但是,注意,写命令升级为 DemandMaster
自动。但是,如果你想传播的负载,您可以选择通过 PreferSlave
和 DemandSlave 推一些读命令(最好是昂贵的)奴隶。code>
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.
这篇关于这是什么StackExchange.Redis做配置的主站/从站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!