Skip to content

Sentinel connection error when using the highIntegrity = true configuration #2992

Open

Description

@thangpv212

I am using Redis with the sentinel model.
Environment information:

Redis version: 7.0.5
StackExchange.Redis version: 2.8.58
My connection string configuration is as follows:
“10.0.0.1:26379,10.0.0.2:26379,10.0.0.3:26379,serviceName=mycluster,abortConnect=false,highIntegrity=true”

I encountered the following error:

StackExchange.Redis.RedisConnectionException: Sentinel: The ConnectionMultiplexer is not a Sentinel connection. Detected as: Standalone
   at StackExchange.Redis.ConnectionMultiplexer.GetSentinelMasterConnection(ConfigurationOptions config, TextWriter log) in /_/src/StackExchange.Redis/ConnectionMultiplexer.Sentinel.cs:line 173
   at StackExchange.Redis.ConnectionMultiplexer.SentinelPrimaryConnectAsync(ConfigurationOptions configuration, TextWriter writer) in /_/src/StackExchange.Redis/ConnectionMultiplexer.Sentinel.cs:line 157
   at Microsoft.Extensions.Caching.StackExchangeRedis.RedisCache.ConnectSlowAsync(CancellationToken token)
   at Microsoft.Extensions.Caching.StackExchangeRedis.RedisCache.GetAndRefreshAsync(String key, Boolean getData, CancellationToken token)
   at Microsoft.Extensions.Caching.StackExchangeRedis.RedisCache.GetAsync(String key, CancellationToken token)
   at Microsoft.Extensions.Caching.Distributed.DistributedCacheExtensions.GetStringAsync(IDistributedCache cache, String key, CancellationToken token)

Before setting highIntegrity=true, I did not encounter this error.

Please help me find the root cause of the error.
Thank you!

Activity

  1. changed the title [-]Lỗi kết nối Sentinel nếu sử dụng cấu hình highIntegrity = true[/-] [+]Sentinel connection error when using the highIntegrity = true configuration[/+] on Jan 12, 2026
  2. mgravell commented on Jan 13, 2026

    @mgravell
    Member

    I think this is most-likely the same thing as #2980, with different causality; looking

  3. thangpv212 commented on Jan 13, 2026

    @thangpv212
    Author

    I think this is most-likely the same thing as #2980, with different causality; looking

    Hi @mgravell
    I have debugged and identified 2 issues here:

    1. When configuring highIntegrity=true, messages are validated using HighIntegrity, including messages with command=SENTINEL. These command=SENTINEL messages always fail at this validation step.
      I tried an alternative connection method so that command=SENTINEL messages would not be validated, and the result was successful.
    //...
    opts.HighIntegrity = false;
    var sentinelConnection = await ConnectionMultiplexer.SentinelConnectAsync(opts, logWriter);
    opts.HighIntegrity = true;
    var multiplexer = sentinelConnection.GetSentinelMasterConnection(opts, logWriter);
    

    instead of

    //...
    opts.HighIntegrity = true;
    var multiplexer = await ConnectionMultiplexer.ConnectAsync(opts, logWriter);
    

    I really want to use highIntegrity=true in combination with a Sentinel-type connection. However, I believe this is not a standard connection approach, so I am not applying it to my project.

    1. Regarding the error message:
      StackExchange.Redis.RedisConnectionException: Sentinel: The ConnectionMultiplexer is not a Sentinel connection. Detected as: Standalone
      I think this error message is not very helpful. It should provide a more accurate description of the actual error.

    I hope this information will be useful. Thank you!

  4. mohsinaliwork686-rgb commented on Nov 3, 2026

    @mohsinaliwork686-rgb
    Contributor

    Hi @mgravell, I'd like to pick this up, unless you already have something from when you looked in January. It still happens on 3.4.31 and on main (9d17974). With Redis 7.4 and one Sentinel, 127.0.0.1:26379,serviceName=mymaster,highIntegrity=true fails with "Sentinel: Failed connecting to configured primary", and SentinelConnectAsync with HighIntegrity = true fails with ResponseIntegrityFailure ... ResponseSequenceCheck. Both work with highIntegrity=false.

    It looks separate from #2980: high integrity follows each command on an interactive connection with an ECHO, but CommandMap.Sentinel has no echo, and Sentinel rejects it anyway (ERR unknown command 'echo'), so every command on the sentinel connection fails its check. The serviceName path builds that connection from a copy of the user's options, so it inherits the flag.

    What I have in mind is to leave high integrity off for sentinel connections only, so the primary connection from GetSentinelMasterConnection keeps it. That could go in PhysicalBridge, where it's switched on, by skipping sentinel multiplexers (which also covers SentinelConnect), or by clearing the flag on the sentinel copy in SentinelPrimaryConnect; I'd lean to the first. A unit test could use InProcessSentinelServer, like SentinelPrimaryDemotionUnitTests, connecting with ServiceName and HighIntegrity = true. I'd leave the clearer error message from the second part of the issue out of it.

    Shall I open a PR against main?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions