I have following implementation of RedisManager (single method for get is given for reference)
I am using .net core 3.1 with redis version 5.0.3 on redhat linux
I am getting following error
UnableToConnect on 127.0.0.1:6379/Interactive, Initializing/NotStarted, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 0s ago, last-write: 0s ago, keep-alive: 180s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 0s ago, v: 2.1.30.38891
Even if server able to connect to the redis but i am keep getting this error.
Any idea what needed to be done. At the moment I am using password less connection
public static class RedisManager
{
private static readonly ILog Logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
//todo: Any public static members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
//http://gigi.nullneuron.net/gigilabs/setting-up-a-connection-with-stackexchange-redis/
//https://github.com/StackExchange/StackExchange.Redis/blob/master/Docs/Configuration.md
private static readonly Lazy<ConfigurationOptions> ConfigOptions = new Lazy<ConfigurationOptions>(() =>
{
ConfigurationOptions configOptions = null;
try
{
var redisInfo = GetOptionsFrom Configuration();
configOptions = new ConfigurationOptions();
configOptions.EndPoints.Add(redisInfo.RedisServerNameOrIp + ":" + redisInfo.RedisServerPort);
configOptions.ClientName = "SafeRedisConnection_" + DateTime.Now.ToString();
if (redisInfo.ConnectTimeout != 0)
{
configOptions.ConnectTimeout = redisInfo.ConnectTimeout * 1000;
}
if (redisInfo.SyncTimeout != 0)
{
configOptions.SyncTimeout = redisInfo.SyncTimeout * 1000;
}
configOptions.AbortOnConnectFail = false;
if (redisInfo.KeepAliveDuration != 0)
{
configOptions.KeepAlive = redisInfo.KeepAliveDuration;
}
configOptions.DefaultDatabase = redisInfo.RedisDefaultDatabase;
if (!string.IsNullOrWhiteSpace(redisInfo.RedisServerPassword))
{
configOptions.Password = redisInfo.RedisServerPassword;
}
}
catch (Exception ex)
{
Logger.Fatal(ex, ex);
}
return configOptions;
});
private static readonly Lazy<ConnectionMultiplexer> Conn = new Lazy<ConnectionMultiplexer>(
() =>
{
try
{
if (ConfigOptions != null && ConfigOptions.Value != null)
{
return ConnectionMultiplexer.Connect(ConfigOptions.Value);
}
return null;
}
catch (Exception ex)
{
Logger.Fatal(ex.Message, ex);
return null;
}
});
private static ConnectionMultiplexer Muxer => Conn.Value;
public static string GetStringItem(string key)
{
string val = null;
try
{
IDatabase getDatabase;
if (Muxer != null && (getDatabase = Muxer.GetDatabase()) != null)
{
val = getDatabase.StringGet(key);
getDatabase = null;
}
}
catch (Exception ex)
{
Logger.Fatal(ex.Message, ex);
}
return val;
}
}
Anyone else faced similar error on Redhat Linux problem. Problems was related to some firewalld settings but manually disabling should have allowed the connectivity. I were able to telnet the reis server ip port after disabling firewall but error still coming in app.
Was redis-cli able to talk to the server?
On Sat, 9 May 2020, 08:31 Kamran Shahid, notifications@github.com wrote:
Anyone else faced similar error on Redhat Linux problem. Problems was
related to some firewalld settings but manually disabling should have
allowed the connectivity. I were able to telnet the reis server ip port
after disabling firewall but error still coming in app.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/StackExchange/StackExchange.Redis/issues/1453#issuecomment-626122070,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAEHMGNCNSIR3KL32WAHVLRQUBFRANCNFSM4MZMBF2Q
.
Also: if this is .net framework, it is possible that it is actually an
assembly binding redirect problem masquerading as a network problem. What
framework are you targeting here?
On Sat, 9 May 2020, 09:35 Marc Gravell, marc.gravell@gmail.com wrote:
Was redis-cli able to talk to the server?
On Sat, 9 May 2020, 08:31 Kamran Shahid, notifications@github.com wrote:
Anyone else faced similar error on Redhat Linux problem. Problems was
related to some firewalld settings but manually disabling should have
allowed the connectivity. I were able to telnet the reis server ip port
after disabling firewall but error still coming in app.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/StackExchange/StackExchange.Redis/issues/1453#issuecomment-626122070,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAEHMGNCNSIR3KL32WAHVLRQUBFRANCNFSM4MZMBF2Q
.
It is with .net core 3.1 application on redhat linux 8.
I were able to connect to redis using redis desktop manager.
Any thing wrong the way i use to redis using my RedisManager Class?
I receive the same error. A working project, upgrade from 2.0.601 and can no longer connect and get this error. Using 4.7.2 .NET. Redis is on this machine, unable to connect after upgrade
I receive the same error. A working project, upgrade from 2.0.601 and can no longer connect and get this error. Using 4.7.2 .NET. Redis is on this machine, unable to connect after upgrade
Give bit details.
Like Redis version X on (Linux flavor Y or Windows)
.net core 3.1 or .net framework 4.7.2
e.t.c.
Well I don't believe my redis version matters, hence why I left it out. Each of our environments use something different - but once we upgraded from 2.0.601 to 2.1.30 - they ALL lost ability to connect via the application. But to answer your question, for local development I am using the redis-64 nuget package. Nothing else in the app has change, simply upgraded StackExchange.Redis through nuget, ran the app, nothing will connect to the localhost redis. Move the code to any of our environments and likewise, no connectivity. Downgrade back to 2.0.601 and it works again. I also just tried 2.1.28 and it also does not work in our app.
I suspect its something like mgravell hinted at - incompatible libraries loaded. Our app is huge and some if it could be forcing it.
Well I don't believe my redis version matters, hence why I left it out. Each of our environments use something different - but once we upgraded from 2.0.601 to 2.1.30 - they ALL lost ability to connect via the application. But to answer your question, for local development I am using the redis-64 nuget package. Nothing else in the app has change, simply upgraded StackExchange.Redis through nuget, ran the app, nothing will connect to the localhost redis. Move the code to any of our environments and likewise, no connectivity. Downgrade back to 2.0.601 and it works again. I also just tried 2.1.28 and it also does not work in our app.
I suspect its something like mgravell hinted at - incompatible libraries loaded. Our app is huge and some if it could be forcing it.
I agree with @mgravell may be some library incompatibility/ nuget package dependency problem
In my project where it is reference, other packages are
<PackageReference Include="log4net" Version="2.0.8" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="3.1.3" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="3.1.3" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.3" />
<PackageReference Include="StackExchange.Redis" Version="2.1.30" />
<PackageReference Include="System.Diagnostics.EventLog" Version="4.7.0" />
<PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
<PackageReference Include="System.Net.Primitives" Version="4.3.1" />
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
But my application have not much problem in connecting to redis other then one redhat linux server where we have some firewalld related restrictions.
Your problem looks bit different
I got mine working, It was binding redirect issues. It would be SUPER helpful if it reported an error that didn't distract from the actual problem.
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="CC7B13FFCD2DDD51" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0"/>
</dependentAssembly>
Try localhost instead of 127.0.0.1:6379
Try localhost instead of 127.0.0.1
I can think of no scenarios where that would help, sorry.
I've got a similar error trying to connect to Elasticache on AWS and in the end the problem was a missing ssl=true on the connection string. This took me a while to solve since the error message didn't mention anything related to SSL.
Most helpful comment
I got mine working, It was binding redirect issues. It would be SUPER helpful if it reported an error that didn't distract from the actual problem.
<dependentAssembly> <assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Buffers" publicKeyToken="CC7B13FFCD2DDD51" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0"/> </dependentAssembly>