ActiveRecord -- the part of Rails responsible for talking to the database -- does not support the configuration of multiple data sources for the purposes of segmenting reads and writes and directing them to different mysql servers on that basis, at this time, as far as I know.
There is a submitted but to-date-not-accepted patch to do this. Its author considered it "alpha" code at the time. I've tested it a bit. It does function. If you are interested in pursuing it, I can provide patched base.rb and connection_adapter.rb files for ActiveRecord that work circa Rails 1.1.5. The original is here: http://wrath.rubyonrails.org/pipermail/rails-core/2006-July/002019.html Alternatively, you could use multi-master replication. If you go this route you'll need to address issues pertaining to auto_increment collisions. This is fairly easy with MySQL 5 as it has global variables for auto_increment_increment and auto_increment_offset. In a multi-master setup you can load balance the connections coming from Rails to MySQL in at least three different ways: 1. a hardware load balancer, 2. soft load balancing configuration utilizing the IP_VS kernel support in Linux (built in, if you have a fairly recent distribution), or 3. by manipulating the relevant Rails application startup config (database.yml) on a per-rails-server-instance (or per- application-deployment-instance) basis. -- benjamin On Mar 12, 4:24 am, Max Maxim <[EMAIL PROTECTED]> wrote: > Hi there, > > Could you please help me to find some documentation about using Ruby and > several MySQL servers with one way replication there. > > Main idea is to use Masters server for inserting/changing data and Slave > server for selecting data from DB. > > Thanks a lot. > > -- > Posted viahttp://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Deploying Rails" group. To post to this group, send email to rubyonrails-deployment@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-deployment?hl=en -~----------~----~----~----~------~----~------~--~---