aio-libs-abandoned / aioredis-py

asyncio (PEP 3156) Redis support
https://aioredis.readthedocs.io/
MIT License
2.3k stars 336 forks source link

Sentinel pool reconnection #361

Closed kamikaze closed 3 years ago

kamikaze commented 6 years ago

Is there any example on how to manage situation when Redis sentinel connection has been lost and needs to be re-connected? In my case sentinel has same hostname but with different IP every time.

log.server_logger.info('Using {} Redis Sentinels: {}'.format(redis_name, sentinel_nodes))
sentinel = await aioredis.sentinel.create_sentinel_pool(
    sentinel_nodes, password=redis_conf['password']
)
log.server_logger.info('Getting {} master for {} Redis'.format(sentinel_master, redis_name))
pool: ManagedPool = sentinel.master_for(sentinel_master)
pool = aioredis.Redis(pool)
log.server_logger.info('Found {} master for {} Redis: {}'.format(sentinel_master, redis_name, pool))

at this point I have a pool. But when Sentinel restarts... is there any way to automagically re-establish connection? Does aioredis support this?

kamikaze commented 5 years ago

hello?