Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thiagopradi/octopus_replication_example
Sample Rails app using Octopus Library to enable support for replicated database with ActiveRecord
https://github.com/thiagopradi/octopus_replication_example
Last synced: 11 days ago
JSON representation
Sample Rails app using Octopus Library to enable support for replicated database with ActiveRecord
- Host: GitHub
- URL: https://github.com/thiagopradi/octopus_replication_example
- Owner: thiagopradi
- Created: 2010-06-14T04:40:04.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2015-04-16T21:37:09.000Z (over 9 years ago)
- Last Synced: 2024-11-29T12:07:43.491Z (24 days ago)
- Language: Ruby
- Homepage: http://github.com/tchandy/octopus
- Size: 254 KB
- Stars: 8
- Watchers: 2
- Forks: 8
- Open Issues: 2
-
Metadata Files:
- Readme: README.mkdn
Awesome Lists containing this project
README
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:migrateMore 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.