首页 新闻 会员 周边

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

0
悬赏园豆:100 [已解决问题] 解决于 2018-07-23 18:40

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

 

miss星舞的主页 miss星舞 | 初学一级 | 园豆:112
提问于:2018-07-19 19:40
< >
分享
最佳答案
0

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

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

收获园豆:90
悟行 | 专家六级 |园豆:12559 | 2018-07-19 20:19

设置了,还是不行,报同样的错误提示 This operation has been disabled in the command-map and cannot be used: AUTH。

miss星舞 | 园豆:112 (初学一级) | 2018-07-20 08:49

@miss星舞: 加个值试试,反正问题是出在这个地方

悟行 | 园豆:12559 (专家六级) | 2018-07-20 13:24

@miss星舞: 

启用上面有知道的试试

悟行 | 园豆:12559 (专家六级) | 2018-07-20 13:29

@抽象ID: 好的好的 我试试先

miss星舞 | 园豆:112 (初学一级) | 2018-07-20 13:30

@miss星舞: 或者都禁用了,再试试

悟行 | 园豆:12559 (专家六级) | 2018-07-20 13:31

@miss星舞:

从库只能读的,你不要说你往从库里面写缓存

悟行 | 园豆:12559 (专家六级) | 2018-07-20 13:33

@抽象ID: 现在报  This operation has been disabled in the command-map and cannot be used: Get

This operation has been disabled in the command-map and cannot be used: SETEX

这样的错误

miss星舞 | 园豆:112 (初学一级) | 2018-07-20 13:35

@miss星舞: 

从库只能读的,你这是写操作啊,只能对master库写缓存

 你看我上面的截图

悟行 | 园豆:12559 (专家六级) | 2018-07-20 13:36

@抽象ID: 读写都一样,读出 This operation has been disabled in the command-map and cannot be used: Get   写出  This operation has been disabled in the command-map and cannot be used: SETEX

miss星舞 | 园豆:112 (初学一级) | 2018-07-20 13:37

@miss星舞: 你非要在从库中写的话,就把

slave-read-only yes  改成 slave-read-only no

悟行 | 园豆:12559 (专家六级) | 2018-07-20 13:38

@抽象ID: 好的好的  我先试试,谢谢大神解答。

miss星舞 | 园豆:112 (初学一级) | 2018-07-20 13:43

@miss星舞: 

 

https://dotblogs.com.tw/supershowwei/2017/02/27/163018

ConfigurationOptions config = new ConfigurationOptions
{
    EndPoints =
    {
        { "redis0", 6379 },
        { "redis1", 6380 }
    },
    CommandMap = CommandMap.Create(new HashSet<string>
    { // EXCLUDE a few commands
        "INFO", "CONFIG", "CLUSTER",
        "PING", "ECHO", "CLIENT"
    }, available: false),
    KeepAlive = 180,
    DefaultVersion = new Version(2, 8, 8),
    Password = "changeme"
};

CommandMap 替换成上面这个试试,再不行,我也没有办法了

悟行 | 园豆:12559 (专家六级) | 2018-07-20 13:54

@抽象ID: 好的好多  我试试 谢谢,我现在不知道怎么弄的,哨兵都启动不起来了 。

miss星舞 | 园豆:112 (初学一级) | 2018-07-20 14:51
其他回答(2)
0
收获园豆:10
dudu | 园豆:30994 (高人七级) | 2018-07-19 20:05

现在就是参考这块来做的,然后出现了此问题。

支持(0) 反对(0) miss星舞 | 园豆:112 (初学一级) | 2018-07-20 08:28
0

大侠们,我也遇到这个问题,这个问题解决了吗???
StackExchange.Redis.RedisCommandException: This operation has been disabled in the command-map and cannot be used: AUTH

年少不骄横 | 园豆:147 (初学一级) | 2020-01-31 16:46

解决了没?大侠

支持(0) 反对(0) 孝文 | 园豆:202 (菜鸟二级) | 2021-06-10 16:53
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册