octopus is a ruby gem that allows an ActiveRecord application (including ActiveRecord 3/Rails 3 applications) to connect to one master and multiple slave databases. Most of the documentation centers on its sharding features, but I am using it to send writes to the master and reads to the slaves. This is called “replication” in octopus parlance. Since there was no full example of a shards.yml file for full replication, here’s what I’m using:
octopus:
replicated: true
fully_replicated: true
production:
slave1:
adapter: mysql
encoding: utf8
username: user
password: password
host: "db-reader-0"
database: somedb
slave2:
adapter: mysql
encoding: utf8
username: user
password: password
host: "db-reader-1"
database: somedb
What was confusing to me is that it needs replicated and fully_replicated. The master database is the one listed in your standard config/database.yml.