The official documentation on MySQL 5.1  "Using Replication for 
ScaleOut" is explicit and states that it is the application (Django) 
that needs to send the writes to the Master and the Reads to the 
Slaves.    Unless I'm wrong this would rule out using replication with 
Django.  

The quote from the MySQL document is below.  According to quote changing 
Django to handle replication should be relatively trivial (but beyond my 
skill set at present),  - does anybody know whether any work has been 
done on this?

MerMer

"If the part of your code that is responsible for database access has 
been properly abstracted/modularized, converting it to run with a 
replicated setup should be very smooth and easy. Change the 
implementation of your database access to send all writes to the master, 
and to send reads to either the master or a slave. If your code does not 
have this level of abstraction, setting up a replicated system gives you 
the opportunity and motivation to clean it up. Start by creating a 
wrapper library or module that implements the following functions:

    *

      |safe_writer_connect()|

    *

      |safe_reader_connect()|

    *

      |safe_reader_statement()|

    *

      |safe_writer_statement()|

|safe_| in each function name means that the function takes care of 
handling all error conditions. You can use different names for the 
functions. The important thing is to have a unified interface for 
connecting for reads, connecting for writes, doing a read, and doing a 
write."



Julio Nobrega wrote:
>   Yes, there's a way, but it's not in Django that you do this, but on
> the database. You don't need to configured Django (or any application
> accessing the database) to "talk" to slave hosts. It's the job of the
> database server software to abstract this step for you.
>
>   You're going to setup slaves to a master host, and in most cases,
> the former will be used for SELECT and the latter to I/U/D.
>
>   What happens is something like this: Master M and slaves S1 and S2
> are configured. Application asks M for row id 15. M sends query to S1.
> S1 answers to M who answers to application. Application asks for row
> id 20. M sends to the next slave, S2, and so on. As new queries keep
> coming, so M keeps rotating between its slaves.
>
> On 4/8/07, Merric Mercer <[EMAIL PROTECTED]> wrote:
>   
>> The django book's chapter on deployment mentions  the use of Database
>> replication as a means to scale using MySQL.
>>
>> My understanding with Database replication is it uses  a MASTER DB and a
>> number of SLAVES.
>> The master updates the slaves, asynchronously.  This means that the
>> slaves are used for reading data only and only the master is used for
>> writing data.
>> As the number of reads typically exceed the number of writes replication
>> is supposed to work well.
>>
>> However, I can't figure out how Django handles it.  I can't see anything
>> in the documentation or the settings that would allow writes to be
>> handled by a different host to the reads.
>>
>> Is there a way to do this?
>>
>> MerMer
>>
>>
>>     
>
>
>   


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to