StackExchange.Redis 链接 Sentine模式报问题。

2019-01-02 23:27发布

在使用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);

 

2条回答
女痞
2楼-- · 2019-01-03 00:09

代码没有问题,是redis配置改一下:redis.conf 中的改成这样     rename-command CONFIG ""

 https://redis.io/topics/security#disabling-of-specific-commands

查看更多
登录 后发表回答