在使用stackexchange redis客户端库通过sentinel连接受密码保护的Redis服务器爆出这样的问题:This operation has been disabled in the command-map and cannot be used: AUTH
代码是这样写:
var options = new ConfigurationOptions()
{
CommandMap = CommandMap.Sentinel,
EndPoints = { { "10.88.5.146", 26379 },{ "10.88.5.147", 26379 }},
AllowAdmin = true,
TieBreaker = "",
Password = "12345641",
ServiceName = "mymaster",
SyncTimeout = 5000,
AbortOnConnectFail = true,
DefaultVersion = new Version(3, 0),
Ssl = false
};
var connection = ConnectionMultiplexer.Connect(options);
相关问题
- Faster loop: foreach vs some (performance of jsper
- Why wrapping a function into a lambda potentially
- Getting Redis Master address from Sentinel C#
- Ado.net performance:What does SNIReadSync do?
- Device support warning : Google play 2019
代码没有问题,是redis配置改一下:redis.conf 中的改成这样
rename-command CONFIG ""
https://redis.io/topics/security#disabling-of-specific-commands
参考 Added Sentinel Support to ConnectionMultiplexer