Closed attururosireddy closed 7 months ago
This is intriguing, but I suspect there's something config related; testing locally, I have a 7.1.240 server:
marc@mgx:~$ redis-cli
127.0.0.1:6379> info server
# Server
redis_version:7.1.240
and testing with:
using StackExchange.Redis;
using var muxer = ConnectionMultiplexer.Connect("localhost");
Console.WriteLine(muxer.IsConnected);
foreach (var server in muxer.GetServers())
{
Console.WriteLine($"{server}: {server.Version}");
}
I see:
True
MGX(SE.Redis - v2.7.17.27058): 7.1.240
so: I accept that it isn't connecting, but: there is no fundamental/inherent reason that it shouldn't, which means we need to look more at "why?"
The first thing I would suggest is: try connecting from that same machine via redis-cli
- much like I have above. If that fails, all bets are off. In particular: does:
redis-cli -h redisserver info server
work from the test machine?
My initial hunches, to be explicit:
sh-5.1$ redis-cli -h redisserver info server
DENIED Redis is running in protected mode because protected mode is enabled and no password is set for the default user. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a an authentication password for the default user. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside.
so... fix that :) this is entirely a "your server" thing
But I am getting valid response from Redis 6 server with same below redis.conf
save 60 1 dbfilename dbname.rdb dir ./ bind 0.0.0.0 port 6379
Connection didnt establish when I upgrade from Redis 6 to Redis 7
Yes, redis 7 at the server changes the security mode in the scenarios described in the DENIED
; you upgraded the server to 7, which means those new redis 7 rules apply. You need to pick one of the available options described (1-4, as most appropriate to your needs), and do that.
To rephrase: redis 7 has changed the rules, and is rejecting your connection. I can't do anything about that at the client - all clients (including redis-cli
) will be unable to connect if the server doesn't allow remote connections; you need to reconfigure the server. Options 1 and 2 use the redis 6 rules; option 3 only applies to ad-hoc runs, and option 4 needs you to configure the client and server with the same auth credentials.
@mgravell Thank you very much for this command "redis-cli -h redisserver info server" which helped to find the root cause
Checking notes, it looks like protected mode has existed since 3.2.0 - I wonder if it is possible that your redis 6 server was running, but CONFIG SET protected-mode no
had been executed, without a CONFIG REWRITE
, i.e. the reconfiguration was transient in the running server process, but the moment you restarted the server (as part of the upgrade) it defaulted back to protected mode.
Connection is not establishing with redis 7 server using StackExchange.Redis 2.7.17. But the same code works with redis 6 server.
Is StackExchange.Redis 2.7.17 compatible with redis 7. Please share your views
Please find the below logs
(edited for formatting)