DalliError: No server available, port 11211 -- connection refused

For the sake of testing I’m running my app on my VPS server this way:

  RAILS_ENV=staging rails s -p 3000 -b 0.0.0.0 

I have exception:

  [Worker(host:ip-11-22-33-44 pid:2844)] Starting job worker
  2018-07-03T04:39:04+0000: [Worker(host:ip-11-22-33-44 pid:2844)] Starting job worker
  
  [Worker(host:ip-11-22-33-44 pid:2844)] Job EmailConfirmationJob (id=1) (queue=default) RUNNING
  2018-07-03T04:39:04+0000: [Worker(host:ip-11-22-33-44 pid:2844)] Job EmailConfirmationJob (id=1) (queue=default) RUNNING
  {"tag":"delayed_job","free":"Running job","type":"running","structured":{"job_name":"EmailConfirmationJob","args":{"email_id":1,"community_id":1}}}
  
  127.0.0.1:11211 failed (count: 0) Errno::ECONNREFUSED: Connection refused - connect(2) for "127.0.0.1" port 11211
  DalliError: No server available
  
  127.0.0.1:11211 failed (count: 1) Errno::ECONNREFUSED: Connection refused - connect(2) for "127.0.0.1" port 11211
  
  127.0.0.1:11211 is down
  DalliError: No server available


  //...................
  sh: 1: /usr/sbin/sendmail: not found

The port 11211 is of Memcached, right? Where in my app should I configure it?

Or should I use Redis?

In the documentation none of them are mentioned

You can choose redis or memcached cache store, see

https://github.com/sharetribe/sharetribe/blob/master/config/environments/staging.rb#L60

For redis you should add ENV vars like:

redis_host=localhost
redis_port=6379
redis_db=0

As default sharetribe config is for Memcachier servers like for apps on Heroku, for using local memcached server you can simplify config line:

config.cache_store = :dalli_store, 'localhost:11211'
1 Like

but nothing in the documentation?

I fixed it by running sudo apt-get install memcached