【发布时间】:2019-12-19 18:59:53
【问题描述】:
我在一个单独的环境中有 redis 服务器,可以通过 SSH 隧道连接。通过提供适当的服务器地址和密码,我可以使用 Redis 桌面管理器访问 Redis 服务器,但我无法从我的控制台应用程序连接它。下面是我用过的代码
ConnectionMultiplexer _connection =
ConnectionMultiplexer.Connect("some_address,password=redis,abortConnect=false");
IDatabase _cache = _connection.GetDatabase();
_cache.StringSet("TestKey", "TestValue");
尝试在 Redis 数据库中插入字符串值时出现以下错误。
StackExchange.Redis.RedisConnectionException
HResult=0x80131500
Message=No connection is available to service this operation: SET CHeckingTest; UnableToConnect on some_address:6379/Interactive, Initializing/NotStarted, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 5s ago, last-write: 5s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 0s ago, v: 2.0.601.3402; IOCP: (Busy=0,Free=1000,Min=4,Max=1000), WORKER: (Busy=0,Free=2047,Min=4,Max=2047), Local-CPU: n/a
Source=StackExchange.Redis
StackTrace:
at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](Message message, ResultProcessor`1 processor, ServerEndPoint server) in C:\projects\stackexchange-redis\src\StackExchange.Redis\ConnectionMultiplexer.cs:line 2237
at StackExchange.Redis.RedisBase.ExecuteSync[T](Message message, ResultProcessor`1 processor, ServerEndPoint server) in C:\projects\stackexchange-redis\src\StackExchange.Redis\RedisBase.cs:line 54
at StackExchange.Redis.RedisDatabase.StringSet(RedisKey key, RedisValue value, Nullable`1 expiry, When when, CommandFlags flags) in C:\projects\stackexchange-redis\src\StackExchange.Redis\RedisDatabase.cs:line 2407
at Redis_sample.Program.Main(String[] args) in C:\Users\Anish George\Desktop\Redis\CacheComponent\Redis_sample\Program.cs:line 66
Inner Exception 1:
RedisConnectionException: UnableToConnect on some_address:6379/Interactive, Initializing/NotStarted, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 5s ago, last-write: 5s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 0s ago, v: 2.0.601.3402
我应该提供哪个密码?我有一个 SSH 隧道密码和另一个 Redis 服务器密码,端口号也不同。如何通过控制台应用程序连接 ot Redis?
【问题讨论】:
标签: redis