Skip to content

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

Notifications You must be signed in to change notification settings

jerrod/ey-chef-seamless_database_pool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

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
  
  1. Add the extra N instances of database slaves to your EngineYard environment.
  2. 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.
  3. Add the seamless_database_pool recipe to you main cookbook at /cookbooks/main/recipes/default.rb

    require_recipe "seamless_database_pool"
  
  1. Add the following to your /deploy/before_migration.rb

    run "ln -nfs #{release_path}/config/database_cluster.yml  #{release_path}/config/database.yml"
  
  1. Commit and push everything
  2. Load the recipe onto your environment via the engineyard cli, waiting

    $ ey recipes upload
    $ ey recipes apply
    $ ey deploy
  
  1. 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.

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages