# Memcached loses sessions during clusters

**URL:** <https://www.ruby-forum.com/t/memcached-loses-sessions-during-clusters/112341>\
**Category:** Rails\
**Created:** [August 17, 2007, 5:50pm UTC](https://www.ruby-forum.com/t/memcached-loses-sessions-during-clusters/112341 "2007-08-17T17:50:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![innr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/ec9cab/32.png) [@innr](https://www.ruby-forum.com/u/innr)\
**Post date:** [August 17, 2007, 5:50pm UTC](https://www.ruby-forum.com/t/memcached-loses-sessions-during-clusters/112341/1 "2007-08-17T17:50:08Z")

</div>

Hello,

My memcached seems to work OK for a single mongrel instance. When I  
move to  
a mongrel cluster, memcache seems to lose the session state between  
mongrel  
cluster instances.

I am using the standard memcached configuration (with memcache-client),  
as  
shown below. Any ideas?

=========================================

require\_gem ‘memcache-client’  
Rails::Initializer.run do |config|  
config.action\_controller.session\_store =:mem\_cache\_store  
end  
memcache\_options = {  
:compression =\> true,  
:debug =\> false,  
:namespace =\> “pr-#{RAILS\_ENV}”,  
:readonly =\> false,  
:urlencode =\> false  
}  
memcache\_servers = [‘127.0.0.1:11211’]  
CACHE = MemCache.new(memcache\_options)  
CACHE.servers = memcache\_servers  
ActionController::Base.session\_options[:cache] = CACHE

===========================================

## -Iain

View this message in context:  
[http://www.nabble.com/memcached-loses-sessions-during-clusters-tf4286529.html#a12202050](http://www.nabble.com/memcached-loses-sessions-during-clusters-tf4286529.html#a12202050)  
Sent from the RubyOnRails Users mailing list archive at [Nabble.com](http://Nabble.com).
