Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails + Dalli memcache gem: DalliError: No server available

Hi I'm having trouble setting up my Rails project on my server because apache keeps complaining

DalliError: No server available.

I installed memcached on my ubuntu machine, but it still doesn't work. My rails project also has config.cache_store = :dalli_store, 'localhost:11211', { :namespace => "production" } in environments/production.rb. How would I debug this?

My log shows before each request:

localhost:11211 failed (count: 6)
DalliError: No server available

telnet to 11211:

    root@s2:/usr/local/www/production/current/log# telnet localhost 11211
    Trying 127.0.1.1...
    telnet: Unable to connect to remote host: Connection refused
like image 808
bigpotato Avatar asked Aug 28 '13 20:08

bigpotato


3 Answers

I had the same problem. First I installed memcached as a gem gem install memcached and got the error "DalliError: No server available"

Then I installed memcached by doing sudo apt-get install memcached. It works fine now.

like image 173
Sagar Arlekar Avatar answered Nov 05 '22 14:11

Sagar Arlekar


If you're a Homebrew user:

brew install memcached

Check if the service is running:

brew services list

If not, start it:

brew services start memcached
like image 13
Bryan Ash Avatar answered Nov 05 '22 15:11

Bryan Ash


It was because someone changed the /etc/hosts file to point 127.0.1.1 to localhost instead of 127.0.0.1. After changing that, memcached worked.

like image 3
bigpotato Avatar answered Nov 05 '22 16:11

bigpotato