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

Unable to configure AWS elasticache redis with channel_redis #381

Open
SanaZulfiqar opened this issue Jan 31, 2024 · 3 comments
Open

Unable to configure AWS elasticache redis with channel_redis #381

SanaZulfiqar opened this issue Jan 31, 2024 · 3 comments

Comments

@SanaZulfiqar
Copy link

Hello,
I am trying to use AWS Elasticache Redis cluster as backend with channels_redis for connecting to websocket. However, I am unable to configure that as container get restarted every time try making connection. It works well if i connect the single host redis instead of cluster one.

This is the configuration i am using:

CHANNEL_LAYERS = {
    "default": {
        "BACKEND": "channels_redis.core.RedisChannelLayer",
        "CONFIG": {
            "hosts": [("configration_endpoint", "port")],
            "capacity": 10_000,
            "prefix":  "channel-layer:",
        },
    },
}

Version of channels-redis:

channels==3.0.4
channels-redis==3.3.0
  • What you expected to happen?
    AWS elasticache redis working well with django channels

I am using uvicorn to run the channel.

@sevdog
Copy link
Contributor

sevdog commented Feb 16, 2024

Could you please provide a stacktrace or a log which shows which the error?

Which kind of configuration are you using to run your project?

@Sanji515
Copy link

Sanji515 commented Dec 4, 2024

I think we are not able to support AWS Elasticache Cluster mode with channels_redis. As it does not have native support for Redis clusters. It can connect to a single Redis instance or a simple setup with multiple Redis instances configured as separate hosts, but it cannot handle Redis cluster features like key distribution and MOVED responses out-of-the-box.

redis-py-cluster <- This Python library is specifically designed to work with Redis clusters and will handle the MOVED redirection automatically. But it cannot be direct integrated with channels_redis

I'm not sure, probably as a workaround we need to create a custom backend using RedisChannelLayer to add redis cluster client from redis-py-cluster to work with Redis Cluster for AWS Elasticache.

@amirreza8002
Copy link

amirreza8002 commented Dec 4, 2024

redis-py-cluster is not maintained
redis-py itself has cluster support now.

but yes cluster and normal servers are different
you can't/shouldn't connect to one using the other

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

4 participants