I can't find any way to subscribe other channels after entered the "pub/sub" mode when using the redis-cli. For example:
$ redis-cli
redis> SUBSCRIBE channel:1
Reading messages... (press Ctrl-C to quit)
1) "subscribe"
2) "channel:1"
3) (integer) 1
When I press Ctrl-C, the redis-cli is quit instead of "pub/sub" mode. Does anyone know how to solve the problem?
AFAIK, you can't issue new commands in redis-cli after subscribing to a channel. However, the SUBSCRIBE command is variadic since version 2.4, meaning you can pass several channels at once, to subscribe to:
redis 127.0.0.1:6379> SUBSCRIBE channel:1 channel:2
Reading messages... (press Ctrl-C to quit)
1) "subscribe"
2) "channel:1"
3) (integer) 1
1) "subscribe"
2) "channel:2"
3) (integer) 2