Navigation Menu

Skip to content

thiagopradi/octopus_replication_example

Repository files navigation

Octopus Replication Example

This is a sample rails application demonstrating replication features in octopus. The application have 1 master, (specified in database.yml) and 4 slaves (specified in shards.yml).

Feature list:

All writes will be sent to master, and the read queries will be sent to the slaves. unless you have a transaction, so , all queries will be sent to master.

The application have two different models: Client and User. User is a replicated model, and Client isn't replicated. So, when you create a new User, you will see a exception, because you don't have configuration for replication and Rails tries to read the user from a slave database, and the write query have been sent to master (Default behaviour when using replication). When you create a new client, everything should works fine, it will read and write in the master database.

Setup:

You will need two commands to setup the application:

 rake db:octopus && rake db:migrate 

More info could be found at Octopus Wiki

Thanks

This project is sponsored by the Ruby Summer of Code, and my mentors Mike Perham and Amit Agarwal.

Copyright

Copyright (c) 2010 Thiago Pradi, released under the MIT license.

About

Sample Rails app using Octopus Library to enable support for replicated database with ActiveRecord

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published