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.
on 12.03.2007 12:24
on 18.03.2007 17:17
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 <ruby-forum-incom...@andreas-s.net>
on 20.03.2007 04:13
Here's an alternative--SQLRelay: http://sqlrelay.sourceforge.net/sqlrelay/dropin/mysql.html It leaves the connection pooling and segmenting reads vs. writes to the driver (which in turn delegates to the real driver). I haven't used it, but this is the direction I was planning on going after talking it over with a few people (and considering such an AR patch). Let us know how it works out for you if you give it a shot. seth
on 20.03.2007 15:30
> 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. [skip] > 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. [skip] > -- > benjamin Hi, Thanks for this guide light. I will think about patch. As About two-way replication then I thought about it. Unfortunately I do not have experience with it. I am only using one-way (old approved method). Could please you share your experience if you have used MySQL with two-way replication and give me your feedback how it works. Thanks again.
on 20.03.2007 15:32
Seth Fitzsimmons wrote: > Here's an alternative--SQLRelay: > http://sqlrelay.sourceforge.net/sqlrelay/dropin/mysql.html > > It leaves the connection pooling and segmenting reads vs. writes to > the driver (which in turn delegates to the real driver). I haven't > used it, but this is the direction I was planning on going after > talking it over with a few people (and considering such an AR patch). > > Let us know how it works out for you if you give it a shot. > > seth Hi, Thanks you for this solution too. :-) If I will use it of course I get my feedback to you.
on 22.03.2007 19:18
Has anyone tried the beta MySQL-HA (High Availability) stuff with Rails? We currently have a Dual Master MySQL setup but are basically just pointing everything to one of the servers right now... MySQL-HA project site - http://sourceforge.net/projects/mysql-ha/ MySQL-HA home page - http://www.seriema-systems.com/mysql-ha/ MySQL-HA blog - http://gnuserland.blogspot.com/ On Mar 12, 5:24 am, Max Maxim <ruby-forum-incom...@andreas-s.net>
on 01.05.2007 11:55
benjamin wrote: > 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 Hello Benjamin, I have started to implementing this solution and faced with problem :( First of all I am not able to apply patch you provided. (I am using Rails 1.1.6). So patch should be rather different. I will very appreciate if you can guide me where can I find additional documentation about it, also may be you can provide me base and connection_adapter files for Rails 1.1.5. Thanks a lot.
on 05.10.2007 16:06
Max Maxim wrote: > Hi, > > Thanks for this guide light. I will think about patch. > > As About two-way replication then I thought about it. > Unfortunately I do not have experience with it. I am only using one-way > (old approved method). > Could please you share your experience if you have used MySQL with > two-way replication and give me your feedback how it works. > > Thanks again. Forgot to tell you my feedback. We have remade source code to use MySQL master for write and MySQL slave to reed data. :-(