Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#33496 closed New feature (wontfix)

Auto database mirroring.

Reported by: M Hadi Azarabad Owned by: nobody
Component: Database layer (models, ORM) Version: 4.0
Severity: Normal Keywords: multi-database / mirror database
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tim Graham)

Hi. I'm looking for a solution to save data on mirror database. Using database routers allow us to save a record and lets us decide which database must be used and I think manual database selection is not optimal because it uses ORM to create raw SQL twice or more (based on the number of mirror database).'db_1')'db_2') 

I think django can handle this problem and optimize it by adding setting list variable called MIRROR_DATABASES so all mirror databases place in there and Django save all of records by creating one raw SQL if mirror databases using the same backend.

Change History (3)

comment:1 by Tim Graham, 2 years ago

Description: modified (diff)

comment:2 by Mariusz Felisiak, 2 years ago

Resolution: wontfix
Status: newclosed
Summary: mirror database in djangoAuto database mirroring.

As far as I'm aware database mirroring is not something a web framework should be responsible for, see a handy comparison of different solutions in PostgreSQL's docs. Duplicating all the operations would be inefficient, very complex, and error-prone.

comment:3 by Steven Mapes, 2 years ago

Following on from Mariusz's reply with the Postgres reference on HA, load balancing and replication here's MySQL's replication solutions and MySQL Proxy which can be used as load balancer to distribute requests and perform automatic failover, here's a Digital Ocean install guide for the latter.

If you are using MariaDB then here's the replication docs to get you started.

If you are looking at Multi-Master using either then look into Galera Cluster but these will be better solutions than writing twice from code

Note: See TracTickets for help on using tickets.
Back to Top