Note that there are some explanatory texts on larger screens.

plurals
  1. POReplicated Master/Slave Servers and databases
    text
    copied!<p>I have a small Rails app I have deployed on heroku's free tier with only an API and no views to create Books, return a Book's genre, and remove all Books from the database. It looks a little like this:</p> <p>A <code>POST request to site.herokuapp.com/add_book?name=harrypotter&amp;genre=fantasy</code> adds a book.</p> <p>A <code>GET request to site.herokuapp.com/find_book?name=harrypotter</code> returns the genre.</p> <p>A <code>POST request to site.herokuapp.com/reset clears the database of all books</code></p> <p>Now that I have this working on a single server I want to replicate it across three servers each with a unique URL, so that I can send my calls to any of the 3 servers and have all their databases containing the same Book entries.</p> <p>For example if I send a </p> <pre><code>POST request to site1.herokuapp.com/add_book?name=harrypotter&amp;genre=fantasy </code></pre> <p>then send a </p> <p><code>POST request to site2.herokuapp.com/add_book?name=littlewomen&amp;genre=fiction</code> </p> <p>I can send a </p> <p><code>GET request to site3.herokuapp.com/find_book?name=littlewomen</code> .</p> <p>But if I send a reset call to a server it does not reset the other servers.</p> <p>I found a two gems called <a href="https://github.com/tchandy/octopus" rel="nofollow">Octopus</a> and <a href="https://github.com/bpot/data_fabric" rel="nofollow">Data Fabric</a> but it looks like they replicate across databases on the same server, and not on different servers. Also since I am going to be making calls to three different sites will these gems work?</p> <p>What's the best way to go about this type of database/server replication in Rails?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload