(Ruby) Multiple Servers

Jean Verger jean.verger at gmail.com
Wed Sep 20 11:46:10 UTC 2006


Hi,
I'm running memcached in 2 servers. Both servers, are at the same time
clients (they share memcached).
If only one server is up, there is no problem. It can access both
memcached servers.
Same with the other server.
However, if both servers are trying to access the 2 memcached servers,
then i'm getting random errors (null values retrieved).

Please, could someone take a look to this simple config in Ruby?? why
errors when both accessing?


require 'memcache'

memcache_options = {
  :c_threshold => 10_000,
  :compression => false,
  :debug => false,
  :namespace => "Server5-Wablet-API",
  :readonly => false,
  :urlencode => true
}

memcache_servers = [ '209.190.6.226:9300', '209.190.6.122:9300' ]
Rails::Initializer.run do |config|
...
   config.action_controller.session_store= :mem_cache_store
...
end

CACHE = MemCache.new(memcache_options)
CACHE.servers = memcache_servers
ActionController::Base.fragment_cache_store = :mem_cache_store ,{}
ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.merge!({ 'cache'
=> CACHE })

thanks,

Jean


More information about the memcached mailing list