Giter Site home page Giter Site logo

ahueniken / octopus_replication_example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thiagopradi/octopus_replication_example

0.0 2.0 0.0 260 KB

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

Home Page: http://github.com/tchandy/octopus

Ruby 81.45% HTML 9.91% JavaScript 7.02% CSS 1.62%

octopus_replication_example's Introduction

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.

octopus_replication_example's People

Contributors

thiagopradi avatar

Watchers

James Cloos avatar Adam Hueniken avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.