As part of the Solar-1.0.0alpha2 release, Paul M. Jones included an SQL adapter that lets you connect to master/slave MySQL installations.
Replication enables data from one MySQL database server (called the master) to be replicated to one or more MySQL database servers (slaves). Replication is asynchronous – your replication slaves do not need to be connected permanently to receive updates from the master, which means that updates can occur over long-distance connections and even temporary solutions such as a dial-up service. Depending on the configuration, you can replicate all databases, selected databases, or even selected tables within a data.
When you get into a situation where you need to scale up, you might need a replicated MySQL database setup. In such cases, there is one “master” server that handles reads and writes, and there are one or more “slave” servers that are read-only. This means you need to pick which server you’re going to connect to based on the kind of statement you need to issue (SELECT, INSERT, UPDATE, etc).
The Solar_Sql_Adapter_MysqlReplicated adapter handles all the connections and switching-around for you, and you don’t need change a single line of application code. All you need to do is modify your configuration file to tell it where your master and slave servers are.
- Step-by-step: How to setup MySQL Database replication
- MySQL Replication
- Jayson Minard: Scaling Day-By-Day