我正在使用Microsoft.Web.RedisSessionStateProvider
在 Redis 上存储会话信息。
配置文件如下
<!--
<add name="MySessionStateStore"
host = "127.0.0.1" [String]
port = "" [number]
accessKey = "" [String]
ssl = "false" [true|false]
throwOnError = "true" [true|false]
retryTimeoutInMilliseconds = "5000" [number]
databaseId = "0" [number]
applicationName = "" [String]
connectionTimeoutInMilliseconds = "5000" [number]
operationTimeoutInMilliseconds = "1000" [number]
connectionString = "<Valid StackExchange.Redis connection string>" [String]
loggingClassName = "<Assembly qualified class name that contains logging method specified below>" [String]
loggingMethodName = "<Logging method should be defined in loggingClass. It should be public, static, does not take any parameters and should have a return type of System.IO.TextWriter.>" [String]
/>
我能够读取集群上的写入会话信息。
我的集群有多个 IP 3 节点集群,一个主节点和另一个子节点。
我无法在 Web 配置文件中指定其他 IP 来处理故障转移情况。
假设我有一个包含 172.29.10.11、172.29.10.12、172.29.10.13 的集群,其中 172.29.10.11 是我的主节点,所以我将此 IP 放在 web.config 文件中
host = "172.29.10.11"
现在,万一发生故障,0.12 或 0.13 将成为我的主节点。
我该如何处理故障转移情况。
我找到了解决方案。我在这里张贴以防万一有人有类似的问题。
有两个参数可以指定 IP:
如果您使用连接字符串,您需要指定所有属性值,例如
<add name="MySessionStateStore" applicationName = "testapp"
type="Microsoft.Web.Redis.RedisSessionStateProvider"
connectionString ="172.29.10.11:6379,172.29.10.12:6379,172.29.10.13:6379,ssl=false,abortConnect=False" />
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句