MySQL Master/Slave with Castle Activerecord
I have an existing web application using Castle Activerecord to interact with a single MySQL database. The Database has recently been reconfigured to replicate to a number of Slaves.
How do you configure Castle Activerecord to direct writes to the MySQL Master and reads to the MySQL Slaves or are there other ways of achieving Master/Slave operation tran开发者_如何学编程sparently in this setup?
I have never done this, but I think this kind of things are better handled at the DB-driver level. Indeed, Connector/J has a specific ReplicationDriver for this purpose. The Connector/NET documentation has a rather vague reference to replication:
Host, Server, Data Source, DataSource, Address, Addr, Network Address:
The name or network address of the instance of MySQL to which to connect. Multiple hosts can be specified separated by &. This can be useful where multiple MySQL servers are configured for replication and you are not concerned about the precise server you are connecting to. No attempt is made by the provider to synchronize writes to the database so care should be taken when using this option. In Unix environment with Mono, this can be a fully qualified path to MySQL socket file name. With this configuration, the Unix socket will be used instead of TCP/IP socket. Currently only a single socket name can be given so accessing MySQL in a replicated environment using Unix sockets is not currently supported.
精彩评论