Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
an ActiveRecord-JDBC plugin for transparently working with mysql master-slave configurations
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.gitignore
README
init.rb

README

an ActiveRecord-JDBC plugin for working with MySQL master slave databases

- install in vendor/plugins directory
- use adapter "mysql"
- use MySQL Connector/J JDBC replication driver: com.mysql.jdbc.ReplicationDriver
- configure your master and slaves in the MySQL JDBC url in the normal way e.g.

jdbc:mysql:replication://masterhost:3306,slavehost:3307/databasename?autoReconnect=false&useUnicode=true&connectionCollation=utf8_general_ci&characterSetResults=utf8&autoReconnectForPools=true&jdbcCompliantTruncation=false&characterEncoding=utf8

- selects which are outside of a transaction will be sent to the slaves
- any non-select queries or queries inside a transaction will be sent to the master
- ActiveRecord::ConnectionAdapters::JdbcAdapter::with_master can be used to force use of the master for all queries 
Something went wrong with that request. Please try again.