Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何订阅+;“奥敦”&引用+;sdown“是的&引用+;“开关主控”;在Redis命令行中?_Redis - Fatal编程技术网

如何订阅+;“奥敦”&引用+;sdown“是的&引用+;“开关主控”;在Redis命令行中?

如何订阅+;“奥敦”&引用+;sdown“是的&引用+;“开关主控”;在Redis命令行中?,redis,Redis,我希望我的redis cli客户端订阅sentinel通知,如“+odown”、“+sdown”、“+switch master”,以下是我尝试的: $ redis-cli 127.0.0.1:6379> subscribe "+odown" 没什么。。。我触发了故障切换,但仍然没有任何结果 为了确保连接正常,我尝试了psubscribe*,并触发了另一个故障切换,我只看到了一系列: 3) "__sentinel__:hello" 4) "

我希望我的redis cli客户端订阅sentinel通知,如“+odown”、“+sdown”、“+switch master”,以下是我尝试的:

$ redis-cli
127.0.0.1:6379> subscribe "+odown"
没什么。。。我触发了故障切换,但仍然没有任何结果

为了确保连接正常,我尝试了
psubscribe*
,并触发了另一个故障切换,我只看到了一系列:

3) "__sentinel__:hello"
4) "127.0.0.1,5001,ece169c208d80543b07a18ead87c53eb4bd87e4a,30,mymaster,127.0.0.1,6380,30"
1) "pmessage"
2) "*"
3) "__sentinel__:hello"
4) "127.0.0.1,5001,ece169c208d80543b07a18ead87c53eb4bd87e4a,30,mymaster,127.0.0.1,6380,30"
1) "pmessage"
2) "*"
3) "__sentinel__:hello"
4) "127.0.0.1,5000,060d95f0255ca3a70fa33b5caa5dbba787c3af55,30,mymaster,127.0.0.1,6380,30"
我可以做什么来订阅这些内部系统事件

sentinelEvent(REDIS_WARNING,"+sdown",ri,"%@");
将事件发布到+sdown频道

在redis sentinel实例上执行此操作

$ ps -ef | grep redis  
root      13961      1  0 21:30 ?        00:00:00 redis-server *:26379 [sentinel]

$ redis-cli -p 26379  
127.0.0.1:26379> subscribe +sdown
Reading messages... (press Ctrl-C to quit)
1) "subscribe"
2) "+sdown"
3) (integer) 1
1) "message"
2) "+sdown"
3) "master mymaster 127.0.0.1 6379"

您似乎是在Redis实例上订阅,而不是在Redis Sentinel上订阅。