Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No master found for 'mymaster' #3186

Open
OctagonDS opened this issue Mar 16, 2024 · 0 comments
Open

No master found for 'mymaster' #3186

OctagonDS opened this issue Mar 16, 2024 · 0 comments

Comments

@OctagonDS
Copy link

Thanks for wanting to report an issue you've found in redis-py. Please delete this text and fill in the template below.
It is of course not always possible to reduce your code to a small test case, but it's highly appreciated to have as much data as possible. Thank you!

Version: What redis-py and what redis version is the issue happening on?
redis==5.1.0b3

Platform: What platform / version? (For example Python 3.5.1 on Windows 7 / Ubuntu 15.10 / Azure)
k8s

Description: Description of your issue, stack traces from errors and code that reproduces the issue
Hi!
Can you please tell me why aioredis.Sentinel returns the error No master found for 'mymaster'.

If you set socket_timeout to minimum 5, the connection works correctly, but after some time the error No master found for 'mymaster' falls again

I need the connection to not drop after connection.

Thanks!

from redis import asyncio as aioredis

async def redis_init(self):
        try:
            self.sentinel = aioredis.Sentinel([(f'{REDIS_HOST}', 26379)], sentinel_kwargs={'password': REDIS_PASSWORD})
            self.master: aioredis.Redis = self.sentinel.master_for("mymaster", password=REDIS_PASSWORD)
            self.slave: aioredis.Redis = self.sentinel.slave_for('mymaster', password=REDIS_PASSWORD)
            logging.info(await self.sentinel.discover_slaves('mymaster'))
            logging.info(await self.sentinel.discover_master('mymaster'))
            logging.info("Connection to Redis Sentinel is up")
        except ConnectionError as e:
            raise logging.error(e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant