redis消息订阅发布

1.登录redis

[root@es ~]# redis-cli
127.0.0.1:6379> 

2.认证

127.0.0.1:6379> AUTH xxxx
OK
127.0.0.1:6379> 

3.订阅1000这个消息

127.0.0.1:6379> SUBSCRIBE 1000
Reading messages... (press Ctrl-C to quit)
1) "subscribe"
2) "1000"
3) (integer) 1

4.给1000发送消息

127.0.0.1:6379> PUBLISH 1000 nihao
(integer) 1
127.0.0.1:6379> PUBLISH 1000 hahaha

 

posted @ 2019-09-19 11:38  启程华夏  阅读(204)  评论(0编辑  收藏  举报