Giter Site home page Giter Site logo

Failover support about django-redis HOT 10 CLOSED

ggarber avatar ggarber commented on July 20, 2024
Failover support

from django-redis.

Comments (10)

niwinz avatar niwinz commented on July 20, 2024 1

Sorry to respond so late.
I have not time to work on this feature. Sorry again.

If I find time later, I will try to advance in the implementation of this feature.

If you think you can help me, pull-requests are welcome.

For now, I'll go to merge the experimental failover client to the master branch, for to make it available fot those who want try it.

from django-redis.

niwinz avatar niwinz commented on July 20, 2024

It is a very interesting feature and I'm working on it. Look at the issue #6.

The general idea is to activate another django backend, in the case of error in connection with the main backend. Now this fact by attempts, but the idea of ​​using the time I find a better solution.

Could better explain point 1? What kind of exceptions, ignores memcached and redis backend does not ignore?

See any progress on https://github.com/niwibe/django-redis/tree/feature/master-slave

Would be happy to receive any help.

Thanks.
Andrey

from django-redis.

niwinz avatar niwinz commented on July 20, 2024

Now i created devel branch, use this instead on master-slave branch for reference.

from django-redis.

niwinz avatar niwinz commented on July 20, 2024

There are some design decisions that are not yet well thoughtful.
Currently I have implemented, when the primary server fails, do automatic switch to another backend. But, i dont known if this is a correct behavior.

Probably would be better to switch to another server redis keeping the current backend.

We also have to see how this fits with master-slave connections and sharding.
Would be happy if you can give your opinion on these issues.

from django-redis.

ggarber avatar ggarber commented on July 20, 2024

Regarding point 1. With official memcached backend if all the memcached servers are down there is no error generated when you use cache.add. With this redis backend you will get a ConnectionError.

In my opinion is more interesting to switch to a different redis instance than to switch to another backend. In fact that is what official memcached backend does and also others like https://github.com/mozilla/django-memcached-pool.

From my understanding it should work fine with sharding, you will just be removing temporarily that node from the hash_ring and the key space associated with that node would be moved temporarily to use a different node.

Regarding master-slave I think it is a different feature and the point should be to provide an alternative backup location for each redis instance. Configuration with sharding + slaves could be something like this

'LOCATION': [ 'X.X.X.X:6379:1/Y.Y.Y.Y:6379:1', 'A.A.A.A:6379:1/B.B.B.B:6379:1']

Thanks a lot for discussing these issues

from django-redis.

niwinz avatar niwinz commented on July 20, 2024

Sorry for not responding sooner.

I like your approach, not just to convince me to do fallback to another backend. I will start to implement this and see how it goes.

Once I already have implemented the basics: patches and testing are welcome.

Thansk a lot.
Andrey

from django-redis.

ggarber avatar ggarber commented on July 20, 2024

Perfect, let me know when available. I set up an environment to make these failover testing with memcached and redis backends and can test easily the new version.

from django-redis.

niwinz avatar niwinz commented on July 20, 2024

I've been thinking and I decided to go step by step. Implement all at once can cause code dirtier and more bugs.

For the next release will enter the first point. There will be the possibility of exceptions to ignore as does memcached. This functionality may be disabled, but is enabled by default. (#16)

from django-redis.

niwinz avatar niwinz commented on July 20, 2024

Now you can try the initial and experimental implementation of failover.

The code found on https://github.com/niwibe/django-redis/tree/feature/simple-autofailover branch.

Simple example of configuration found on tests/test_sqlite_failover.py

The code has small number of print for debug purpose, if you do not like, you can remove them.

from django-redis.

ggarber avatar ggarber commented on July 20, 2024

Perfect!, apparently it works as expected.

But I'm interested in failover support for sharded client. If an instance in the rings fails it should be replaced by their backup server and if it also fails or there is no backup server the instance would be removed from the HashRing. Do you find it interesting?

Thx

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.