jazzband / django-redis

Full featured redis cache backend for Django.
Other
2.86k stars 430 forks source link

redis-sentinel connection error "AUTH <password> called without any password configured for the default user. Are you sure your configuration is correct?" #610

Open krju13 opened 2 years ago

krju13 commented 2 years ago

Hi exports. I am in the troble with django-redis. I use django-redis version django-redis>=5.0.0,<5.1.0. and I make docker image with django application. and I try to connect to redis-sentinel. but the django application just return the error like below. ERROR - create_cache: AUTH <password> called without any password configured for the default user. Are you sure your configuration is correct?

here is the my settings.py

# redis connection factory
DJANGO_REDIS_CONNECTION_FACTORY = 'django_redis.pool.SentinelConnectionFactory'

# These sentinels are shared between all the examples, and are passed
# directly to redis Sentinel. These can also be defined inline.
SENTINELS = [
    (env('REDIS_SENTINEL_IP_1'), 26379),
    (env('REDIS_SENTINEL_IP_2'), 26379),
    (env('REDIS_SENTINEL_IP_3'), 26379)
]

CACHES = {
    "default": {
        "BACKEND": env('DJANGO_CACHE_BACKEND_REDIS'),
        # THE HOSTNAME IN LOCATION is the primary (service/master) name
        # example : redis://dev-redis/db
        # example : redis://staging-redis/db
        "LOCATION": env('DJANGO_CACHE_LOCATION_REDIS'),
        "OPTIONS": {
            # django_redis.client.SentinelClient
            "CLIENT_CLASS": env('DJANGO_CACHE_CLIENT_CLASS'),
            "SENTINELS": SENTINELS,
            "SENTINEL_KWARGS":{'password':env('REDIS_PASSWORD_VALUE')},
            'PASSWORD': env('REDIS_PASSWORD_VALUE'),
            "CONNECTION_POOL_CLASS": "redis.sentinel.SentinelConnectionPool",
        },
        "KEY_PREFIX": "mapsvc"
    }
}

How can I connect with redis-sentinel??? the redis version

# Server
redis_version:6.2.6

Please help me.


+environment explane I am in the kubernetes cluster. the redis-sentinel is the 3 node out of the kubernetes cluster. but it can connect redis-sentinel's node and kubernetes pod. I tried redis-cli -h {master-ip} -p 6379 -a {password} in the redis pod and I can connect to redis.

when I tried in other kubernetes cluster a month before. I used helm to install redis-sentinel. and that time I can easilly connect to redis-sentinel in django.

but can't not this time.

WisdomPill commented 2 years ago

I am no expert in sentinel, @terencehonles coukd you help with this?

Otherwise I will dig in the code sometime in the next few days

frederickishimwe-absa commented 1 year ago

also have the same error

navjotjsingh commented 1 year ago

Getting the same error with Redis. I am not using Sentinel. This happens with Redis 6+.

navjotjsingh commented 1 year ago

A simple solution is to set the password for the default user.

acl setuser default >password

This worked for me.

frederickishimwe-absa commented 1 year ago

Hi,

I’m also struggling to connect to redis sentinel using python Django-redis library, a sample code that works would be appreciated especially using tls

From: Navjot Singh @.> Sent: Wednesday, December 28, 2022 1:06 AM To: jazzband/django-redis @.> Cc: Frederic Ushimwe (ZA) @.>; Comment @.> Subject: Re: [jazzband/django-redis] redis-sentinel connection error "AUTH called without any password configured for the default user. Are you sure your configuration is correct?" (Issue #610)

Getting the same error with Redis. I am not using Sentinel. This happens with Redis 7.

— Reply to this email directly, view it on GitHubhttps://github.com/jazzband/django-redis/issues/610#issuecomment-1366250046, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AZ3TI3W5IVG7NQGKLGJ4UI3WPNY6LANCNFSM5YIQLOZA. You are receiving this because you commented.Message ID: @.***>

Absa Bank Limited is a subsidiary of Absa Group Limited and is an Authorised Financial Services Provider and Registered Credit Provider, registration number: NCRCP7.

Absa Bank Limited provides services to Absa Group Limited and its subsidiaries.

Absa is committed to complying with applicable data privacy laws and to safeguarding the privacy and security of the personal information it collects and processes, in respect of all current and prospective clients. To understand more about how we collect, store, and process your personal information, please view our privacy statement at absa.co.za

This e-mail and any attachments are confidential and intended solely for the addressee and may also be privileged or exempt from disclosure under applicable law. If you are not the addressee, or have received this e-mail in error, please notify the sender immediately, delete it from your system and do not copy, disclose or otherwise act upon any part of this e-mail or its attachments. Internet communications are not guaranteed to be secure or virus-free. We do not accept responsibility for any loss arising from unauthorised access to, or interference with, any Internet communications by any third party, or from the transmission of any viruses. We may monitor replies to this e-mail for operational or business reasons. Any opinion or other information in this e-mail or its attachments that does not relate to our business is personal to the sender and we do not endorse it.