StackExchange.Redis icon indicating copy to clipboard operation
StackExchange.Redis copied to clipboard

Authentication failure when different passwords are used for sentinel and redis

Open rmkm4 opened this issue 4 years ago • 6 comments

I am receiving below error when sentinel and redis are configured with different passwords. Is there a workaround to overcome this error ?

It was not possible to connect to the redis server(s). There was an authentication failure; check that passwords (or client certificates) are configured correctly. AuthenticationFailure (None, last-recv: 34) on 10.33.190.74:6379/Interactive, Flushed/ComputeResult, last: ECHO, origin: SetResult, outstanding: 0, last-read: 0s ago, last-write: 0s ago, keep-alive: 60s, state: ConnectedEstablishing, mgr: 8 of 10 available, last-heartbeat: never, global: 0s ago, v: 2.2.4.27433

rmkm4 avatar Mar 02 '21 20:03 rmkm4

I don't think we support this right now - can you elaborate on your use case for needing 2 passwords, for the 2 connection layers?

NickCraver avatar Jun 26 '21 14:06 NickCraver

Hi @NickCraver I have same issue too, I don't know how to config Sentinel Password, We have 2 different password 1 for Sentinel, 1 for Redis

minhnguyenvan95 avatar Jul 22 '21 02:07 minhnguyenvan95

Hi @NickCraver I have the same issue. Do we have any progress?

BTW, Java already support this feature https://github.com/spring-projects/spring-boot/issues/21353

So, please help to priority this feature. Don't let us lose this game C# vs Java :)

Thanks,

capcom923 avatar Mar 16 '22 07:03 capcom923

I was looking at this, but it's not as trivial to change as it appears - needs more thought. See the problem is we don't know for sure it's a Sentinel until we connect, so inverse to normal reasoning (at least for me) of "SetinelUser, SentinelPassword" settings, you really have new settings for the child servers that sentinels return...or something. The relationship is very odd as a result of connecting and subsequently connecting downstream, needs more thought.

NickCraver avatar Mar 16 '22 23:03 NickCraver

thumbs up

minhnguyenvan95 avatar Apr 05 '22 02:04 minhnguyenvan95

We also need this feature. We are using an anynines Redis instance on CloudFoundry, which provides different usernames and passwords for the sentinel and redis connection. @NickCraver could you please look into it? I think it should be possible now because there is a flag in the configuration (IsSentinel, checks for ServiceName to be set) which is checked before connection See https://github.com/StackExchange/StackExchange.Redis/blob/cb8b20df0e2975717bde97ce95ac20e8e8353572/src/StackExchange.Redis/ConnectionMultiplexer.cs#L685 So the subsequent calls to SentinelPrimaryConnect / ConnectImpl could retrieve different usernames / passwords from the ConfigurationOptions. To aviod breaking changes, we could add a SentinelUser and SentinelPassword to the ConfigurationOptions and fall back to User and Password if not provided. What do you think about that?

christianerbsmehl avatar Apr 30 '24 13:04 christianerbsmehl