When looking into Redis's source code, I find when sentinelRedisInstance is SRI_SENTINEL, sentinelReconnectInstance will not initialize its link->pc and will not subscribe channel "__sentinel__:hello", as the following code shows.
void sentinelReconnectInstance(sentinelRedisInstance *ri) {
...
if ((ri->flags & (SRI_MASTER|SRI_SLAVE)) && link->pc == NULL) {
...
retval = redisAsyncCommand(link->pc,
sentinelReceiveHelloMessages, ri, "%s %s",
sentinelInstanceMapCommand(ri,"SUBSCRIBE"),
SENTINEL_HELLO_CHANNEL);
...
As a result, I think sentinels can't get any message from channel "__sentinel__:hello".
However, in redis's doc, it says
Every Sentinel is subscribed to the Pub/Sub channel sentinel:hello of every master and replica, looking for unknown sentinels. When new sentinels are detected, they are added as sentinels of this master.
I think it means that all sentinels actually subscribe to channel "__sentinel__:hello", but I can't see any corresponding implementation in redis's source code.
Correct me if I'm wrong.
sentinelRedisInstanceof typeSRI_MASTERconnects to master node that this sentinel is monitoring,sentinelRedisInstanceof typeSRI_SLAVEconnects to slave node, andsentinelRedisInstanceof typeSRI_SENTINELconnects to other sentinels.There's no need to subscribe to sentinel's channel, instead, sentinels only need to subscribe to channels of master and slave nodes. If there's a new sentinel, it will publish hello message to master and slave's channel. So that other sentinels will discover them.