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.
- Install the seamless database pool plugin and follow the setup instructions, making sure to include the appropriate code in your ApplicationController.
- Add the extra N instances of database slaves to your EngineYard environment.
- 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.
- Add the seamless_database_pool recipe to your main cookbook at /cookbooks/main/recipes/default.rb
- Add the following to your /deploy/before_migration.rb
- Commit and push everything
- Load the recipe onto your environment via the engineyard cli, waiting
- 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.