Comments (10)
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.
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.
Now i created devel branch, use this instead on master-slave branch for reference.
from django-redis.
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.
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.
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.
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.
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.
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.
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)
- Connection Pooling doesn't work as intended HOT 1
- Pytest 7.0 compatibility HOT 1
- Drop django 4.0
- Drop support for django 3.2 HOT 1
- How to configure and connect redis cluster correctly? HOT 2
- Django `TIMEOUT` setting not working as expected HOT 2
- Which timezone wil it take? system timezone or django timezone HOT 1
- Why Django Redis does not raise exception while connecting to Redis Server with SSL param equal string "False"
- `Expire` method fails when using `DEFAULT_TIMEOUT` HOT 1
- Getting/Setting occasionally extremely slow HOT 5
- django requirements update
- Add NX, XX, GT and LT to expire and pexpire HOT 2
- Multiple redis caches with fallback mechanism HOT 1
- Is it necessary to get coverage of tests directory? HOT 2
- Implementing HGET
- using redis in django getting connection error HOT 1
- strict_map_key
- Connection refused on Celery health checks HOT 3
- how to support hash ops, such as hset, hget...
- Reauthentication with Azure AD / Entra ID
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-redis.