[Mongrel] Mongrel cluster with one app and many mysql databases
jjhogue at sbcglobal.net
Tue Mar 13 15:27:20 EDT 2007
I just got a copy of "Rails Recipes" and I see in the index
15. Connecting to Multiple Databases
I literally just got the book, so I can't give you any details, but
this might help get you to a solution.
Note that the OT comment is probably correct as it is Rails, not
Mongrel that deals with the database. You may want to try the Rails
mailing list archives.
----- Original Message -----
From: "Steve Midgley" <public at misuse.org>
To: <mongrel-users at rubyforge.org>
Sent: Tuesday, March 13, 2007 1:00 PM
Subject: Re: [Mongrel] Mongrel cluster with one app and many mysql
> This is getting a little OT but I think you can easily switch your
> database connections by playing with which environment you're
> in when the rails system starts up. This doesn't get you all the way
> your solution but should point out the line of code you'll want to
> For example, if you were to start up 10 scratch Rails instances and
> 10 entries in your database.yml file, one for each configuration,
> could load 10 different db instances: for each one you would provide
> different "RAILS_ENV" environment variable (corresponding to the
> appropriate entry in database.yml). Then you'd be running 10
> production instances with 10 dif. connections.
> What you want is a little trickier b/c you want to switch db
> on the fly with a single instance of Rails. But I still don't think
> this is going to be too difficult. For example, it's possible access
> alternate database configuration entry with this line of code in the
> environment.rb file:
> How and where to make the switch in an active running Rails server,
> don't know, but it looks very plausible.
> I hope this helps get you started,
> At 09:46 AM 3/13/2007, mongrel-users-request at rubyforge.org wrote:
>>Date: Tue, 13 Mar 2007 14:15:40 +0100
>>From: Jens Carroll <jens.carroll at carroll.de>
>>Subject: Re: [Mongrel] Mongrel cluster with one app and many mysql
>>To: mongrel-users at rubyforge.org
>>Message-ID: <45F6A3FC.4050605 at carroll.de>
>>Content-Type: text/plain; charset=ISO-8859-1
>>I got also more and more to the point where it is clearly not a
>>Thanks for the answer, but if someone has done that before I would
>>really appreciate any pointer.
>>Alexey Verkhovsky schrieb:
>> >> convince mongrel (or the app) to switch databases on request
>> > with the rails routing facilities)
>> > 10 databases with the same structure but different data? This is
>> > You'd have to hack it yourself, probably by replacing
>> > Base.connection with something that will internally hold 10
>> > and switch dynamically.
>> > None of will have anything to do with Mongrel though. Mongrel is
>> not a
>> > J2EE container, it has no notion of database connections.
>> > Alex
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
More information about the Mongrel-users