Giter Site home page Giter Site logo

Comments (2)

jonprindiville avatar jonprindiville commented on July 4, 2024 4

@zhang-haiyang As far as I am aware there is no official support for Redis Cluster here in django-redis.

For a time the actual https://github.com/redis/redis-py client had no support for it either. One way to approach it was https://github.com/Grokzen/redis-py-cluster + https://github.com/jazzband/django-redis/ ...

Recently, though, https://github.com/Grokzen/redis-py-cluster became deprecated because most of that functionality landed in https://github.com/redis/redis-py (🎉)

So far, django-redis doesn't support the new cluster functionality of redis-py. There's some chatter about that over in #606 but mostly just snippets and brainstorms.

I've been meaning to push on that a bit more, but haven't had bandwidth. (But I think I need to figure that out before I can get to Django 4+ so probably can't wait toooooo long.)

I think it's doable... probably need to understand how django-redis wants to integrate cluster stuff into its test suite, though, and I think there might be some typing stuff to think about because RedisCluster and Redis client are separate class hierarchies, but I don't think there's any real big barriers.

from django-redis.

stinovlas avatar stinovlas commented on July 4, 2024

What are the caveats of using this approach?

from django_redis.client import DefaultClient
from redis.cluster import RedisCluster

class ClusterClient(DefaultClient):
    """Cluster enabled client."""

    def connect(self, index=0):
        """Override to connect properly."""
        return RedisCluster.from_url(self._server[index])

I guess it should work for commands that behave the same in single instance and cluster mode. Or will it break horribly in some cases?

from django-redis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.