No commit activity in last 3 years
No release in over 3 years
Database mirroring support for Rails activerecord-sqlserver-adapter
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

activerecord-sqlserver-adapter-mirroring

A simple plugin which adds database mirroring support for Rails MS Sql Server Adapter.

Targets Rails 4.1.x and activerecord-sqlserver-adapter 4.1.0.

Usage

Add to the Gemfile:

gem 'tiny_tds'
gem 'activerecord-sqlserver-adapter-mirroring'

Add mirroring section to the database.yml:

development:
  adapter:  sqlserver
  host:     primary
  database: ...
  username: ...
  password: ...
  mirror: 
    host: mirror

When the connection to the primary host fails, adapter will reconnect to the mirror host.

Running tests

  • Create database named activerecord_unittest_mirroring.

  • Configure mirroring for that database.

  • Create user rails without password, with sysadmin role on both servers. Sysadmin rights are needed because rails user will initiate mirroring failover.

  • Ensure that one server responds to the primary hostname, and another to the mirror hostname.

  • Run tests

    rake test

You can an edit test/database.yml to define better suited parameters for your system.