-
-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error connecting to Sentinel #378
Comments
Hi @mohammed-essa I think your problem is not related to this library (exactly like is not related to StackExchangeDistributedCache I think). The connection is something that is into the main library and here you just send the connection string (or parameters), there is nothing special into the connection with this library |
possibly, agreed, my main issue is that I am looking for a working sample reference using the redis-sentinel topology anywhere with no luck. |
@imperugo I can confirm that the issue does not come from this library directly, but is triggered by it. Today I was in the exact same situation as @mohammed-essa and after looking carefully through my logs, I noticed something odd. But first, here is the log - try to find the issue yourself, it is quite obvious to be honest:
In case it isn't as obvious as I think (now after I found it 😄): My suggestion would therefore be to add this to the documentation of this library. Not sure if we call it a solution or a workaround, but as far as I understood, the multiplexer already performs load balancing (since Sentinel triggers a managed connection) and a connection pool is not necessary anyway. But I might be wrong. |
Hello, |
Hi, As it can be seen, after the call to ConnectionMultiplexer.Connect the hosts of the given configuration are populated with the redis sentinel instances' ips and ports. However if instead of "ConnectionMultiplexer.Connect", "ConnectionMultiplexer.SentinelConnect" is used when the ServiceName property is set then the modified configuration seems to not generate any error and connect to the redis sentinel succesfully. Line 128 in 451f93c
|
Hi all
I am trying to connect to a redis sentinel topology but as of now I have tried StackExchangeDistributedCache and now I am trying the IRedisCacheClient but I am still having the same issue. The redis sentinel is up and I can connect to it from Redis-commander as well but the error I get is:
StackExchange.Redis.RedisConnectionException: It was not possible to connect to the redis server(s). UnableToConnect on redis-sentinel:26379/Interactive, Initializing/NotStarted, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 0s ago, last-write: 0s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 0s ago, v: 2.2.4.27433
The code I am using to connect to the client is:
private RedisConfiguration LoadSentinel()
{
return new RedisConfiguration()
{
AbortOnConnectFail = true,
KeyPrefix = "my_key_prefix",
Hosts = new RedisHost[]
{
new RedisHost(){Host = "redis-sentinel", Port = 26379}
},
ServiceName = "redis-sentinel", // In case you are using Sentinel
AllowAdmin = true,
ConnectTimeout = 3000,
Database = 0,
Ssl = true,
Password = "str0ng_passw0rd",
ServerEnumerationStrategy = new ServerEnumerationStrategy()
{
Mode = ServerEnumerationStrategy.ModeOptions.All,
TargetRole = ServerEnumerationStrategy.TargetRoleOptions.Any,
UnreachableServerAction = ServerEnumerationStrategy.UnreachableServerActionOptions.Throw
},
MaxValueLength = 1024,
PoolSize = 5
};
}
I copied the code StackExchangeRedisExtensions
services.AddStackExchangeRedisExtensions<SystemTextJsonSerializer>((options) => { return appConfig.RedisOptions; });
Can anyone offer any advice on this as I have tried almost everything to get this to work but
The text was updated successfully, but these errors were encountered: