views:

69

answers:

2

I'm having tons of problems with Memcached. It seems to be installed fine locally, I can run the command 'memcached -vv' and see that it's listening. I'm deploying to Heroku (which has this section: http://docs.heroku.com/memcache on using memcached) and definitely have the memcached add-on installed. Here's how my environment is set up:

#environment.rb

Rails::Initializer.run do |config|
...
config.gem 'memcached-northscale', :lib => 'memcached'
require 'memcached'


#production.rb

config.action_controller.perform_caching             = true

config.cache_store = :mem_cache_store, Memcached::Rails.new


# .gems
...
memcached-northscale

Now when I try to run rake:gems install or script/console locally, I get a Seg fault, and when I push it all to heroku and open up the heroku console and try 'mc = Memcached.new' I get a whole set of errors like "Memcached::ServerIsMarkedDead, Memcached::ATimeoutOccurred, Memcached::ConnectionBindFailure, Memcached::ConnectionFailure, Memcached::ConnectionSocketCreateFailure, Memcached::Failure, Memcached::MemoryAllocationFailure, Memcached::ReadFailure, Memcached::ServerError, Memcached::SystemError, Memcached::UnknownReadFailure"

This problem has been bothering me for weeks. 100 million StackOverflow points to anyone who can help.

A: 

to use memcached you need to configure the correct IP and port number inside ruby.

Start a local networked memcached server:

$ memcached -p 11211 &

Now, in Ruby, require the library and instantiate a Memcached object at a global level:

require 'memcached'
$cache = Memcached.new("localhost:11211")

from the Usage section here: http://rubydoc.info/gems/memcached-northscale/0.19.5.4/file/README

use

$ sudo netstat -tulpn | grep memcached

to find out the IP memcached is using

Occam
A: 

So I learned that all that output that I thought was an error, in fact, is not. Embarrassed but glad it's working.

kateray