Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

a Chef cookbook for seamless_database_pool for engine yard mysql master/slave clusters.

branch: master
readme.markdown

Seamless Database Pool for Engineyard Master/Slave Setup

So you have multiple database instances on Engineyard and you want to use the additional instances for reads, but you dont know where to start? Google "master slave engineyard" sometime. Report back if you ever find anything useful beyond this post about Using Masochism which is very helpful if you never plan to expand beyond a single slave.

  1. Install the seamless database pool plugin and follow the setup instructions, making sure to include the appropriate code in your ApplicationController.
    
      class ApplicationController < ActionController::Base
        include SeamlessDatabasePool::ControllerFilter
        use_database_pool :all => :persistent, [:create, :update, :destroy] => :master
      end
    
  2. Add the extra N instances of database slaves to your EngineYard environment.
  3. Grab my seamless_database_pool cookbook from github and add to your cookbooks directory. I am not 100% sure this is correct or accepted, but i like to keep my cookbooks with the app they are associated with, so i have a /cookbooks directory at the root of my applicaton. you will want to rename it "seamless_database_pool". i added ey-chef- to make it easier to find.
  4. Add the seamless_database_pool recipe to you main cookbook at /cookbooks/main/recipes/default.rb
    
      require_recipe "seamless_database_pool"
    
  5. Add the following to your /deploy/before_migration.rb
    
      run "ln -nfs #{release_path}/config/database_cluster.yml  #{release_path}/config/database.yml"
    
  6. Commit and push everything
  7. Load the recipe onto your environment via the engineyard cli, waiting
    
      $ ey recipes upload
      $ ey recipes apply
      $ ey deploy
    
  8. Hammer your server with your performance testing tool (I recommend Siege) and verify that the slaves are getting read requests. The "Graphs" for the instances is a great place to verify without SSH Spelunking.

Got a better way? See something wrong? Let me know below.

Something went wrong with that request. Please try again.