sdepold/sequelize — pull request #345 by janmeier (2012-11-26 14:05:49+00:00)
Title: Read replication for Mysql (experimental)

This pull request provides support for read-replication in mysql. This means providing one server to handle writes and several servers to handle reads. It uses pooling to control the replicas, connecting to them using a round-robin approach each time readPool.connect is called.

Api:
````javascript
sequelize = new Sequelize('innofluence', null, null, {
dialect: 'mysql',
port: 3306
replication: {
read: [
{ host: '8.8.8.8', username: 'anotherusernamethanroot', password: 'lolcats!' },
{ host: 'localhost', username: 'root', password: null }
],
write: { host: 'localhost', username: 'root', password: null }
},
pool: { // If you want to override the options used for the read pool you can do so here
maxConnections: 20,
maxIdleTime: 30000
},
});
````
If you have general settings that apply to all replicas you do not need to provide them for each. Here, dbname and port is propagated to all replicas.

Each replica has the following options:
````javascript
host, port, username, password, database
````