微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Redis Sentinel - 此操作已在命令映射中禁用且无法使用:GET C#

如何解决Redis Sentinel - 此操作已在命令映射中禁用且无法使用:GET C#

 Configurationoptions options = new()
  {
      AllowAdmin = true,ServiceName = "mymaster",KeepAlive = 86400,AbortOnConnectFail = false,ConnectRetry = 5,ConnectTimeout = 5000,SyncTimeout = 5000,ReconnectRetryPolicy = new LinearRetry(5000),EndPoints = { { configuration.GetValue<string>(REdis_HOST),26379 } },Password = configuration.GetValue<string>(REdis_PASSWORD)
  };
ConnectionMultiplexer redis = ConnectionMultiplexer.SentinelConnect(options,Console.Out);
return redis;

根据上面的建议,我删除了 CommandMap 。但是我仍然收到以下错误 -

此操作已在命令映射中禁用且无法使用:GET

[20:30:28 ERR]    at StackExchange.Redis.CommandMap.AssertAvailable(RedisCommand command) in /_/src/StackExchange.Redis/CommandMap.cs:line 169
   at StackExchange.Redis.ConnectionMultiplexer.CheckMessage(Message message) in /_/src/StackExchange.Redis/ConnectionMultiplexer.cs:line 524
   at StackExchange.Redis.RedisBase.ExecuteAsync[T](Message message,ResultProcessor`1 processor,ServerEndPoint server) in /_/src/StackExchange.Redis/RedisBase.cs:line 46
   at StackExchange.Redis.RedisDatabase.StringGetAsync(RedisKey key,CommandFlags flags) in /_/src/StackExchange.Redis/RedisDatabase.cs:line 2430
   at App.Core.RedisCache.RedisConnectionMultiplexer.GetVehicleKey(String IMEI) in D:\Personal\Upwork\Behrad\IoT-App\App.Core\RedisCache\RedisConnectionMultiplexer.cs:line 66
   at Polly.Retry.AsyncRetryEngine.ImplementationAsync[TResult](Func`3 action,Context context,CancellationToken cancellationToken,ExceptionPredicates shouldRetryExceptionPredicates,ResultPredicates`1 shouldRetryResultPredicates,Func`5 onRetryAsync,Int32 permittedRetryCount,IEnumerable`1 sleepDurationsEnumerable,Func`4 sleepDurationProvider,Boolean continueOnCapturedContext)
   at Polly.AsyncPolicy.ExecuteAsync[TResult](Func`3 action,Boolean continueOnCapturedContext)
   at App.Core.Processor.MessageProcessor.<>c__displayClass6_0.<<ProcessAsync>b__2>d.MoveNext() in D:\Personal\Upwork\Behrad\IoT-App\App.Core\Processor\Processor.cs:line 65
StackExchange.Redis.RedisCommandException: This operation has been disabled in the command-map and cannot be used: GET
   at StackExchange.Redis.CommandMap.AssertAvailable(RedisCommand command) in /_/src/StackExchange.Redis/CommandMap.cs:line 169
   at StackExchange.Redis.ConnectionMultiplexer.CheckMessage(Message message) in /_/src/StackExchange.Redis/ConnectionMultiplexer.cs:line 524
   at StackExchange.Redis.RedisBase.ExecuteAsync[T](Message message,Boolean continueOnCapturedContext)

即使使用 mygate 的最新版本,我也无法弄清楚这一点 -

<packagereference Include="StackExchange.Redis" Version="2.2.31" />
<packagereference Include="StackExchange.Redis.Extensions.Core" Version="7.0.1" />

我已经实施了以下提供的建议。但无论如何都没有用- https://github.com/StackExchange/StackExchange.Redis/issues/1518

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。