[Mongrel] Sharing a mongrel cluster in a multi-url environment

John Almberg jalmberg at identry.com
Wed Feb 11 14:03:41 EST 2009


For anyone who was interested in this thread, I discovered that the  
session loss problem only occurred when:

1. two sites were using the same mongrel (as would happen in a  
mongrel_cluster), and
2. the app uses ActiveRecord storage for sessions
2. the database containing the sessions table was switched

The key was to use a common database that contained the sessions  
table (and client table). This common database is used when rails  
first fires up. The application can then switch the other tables to  
the client database, as selected by the domain name.

As long as you don't switch the session table database, it works  
fine, with no session loss. Having a single client table (that  
contains the client domain name, and database parameters) is also  
convenient.

BTW, there is a good discussion of this topic here: http:// 
wiki.rubyonrails.org/rails/pages/HowtoUseMultipleDatabases

That article pretty much gave me the solution. Thanks Dave Thomas!

-- John

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Websites and Marketing for On-line Collectible Dealers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IDENTRY, LLC
John Almberg - Managing Partner
(631) 546-5079
jalmberg at identry.com
www.identry.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





More information about the Mongrel-users mailing list