Error connecting to Redis on localhost - Rebuilt

Hello. Here are the error logs. I had to re-enable the email account, but even after doing so and tripple checking the app.yml settings, I’m still getting the following error.

Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED) subscribe failed, reconnecting in 1 second. Call stack ["/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/redis-4.0.1/lib/redis/client.
rb:344:in `rescue in establish_connection'", "/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/redis-4.0.1/lib/redis/client.rb:328:in `establish_connection'", "/var/www/discourse/vendor/bundle/ruby/2.5
.0/gems/redis-4.0.1/lib/redis/client.rb:99:in `block in connect'", "/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/redis-4.0.1/lib/redis/client.rb:291:in `with_reconnect'", "/var/www/discourse/vendor
/bundle/ruby/2.5.0/gems/redis-4.0.1/lib/redis/client.rb:98:in `connect'", "/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/redis-4.0.1/lib/redis/client.rb:363:in `ensure_connected'", "/var/www/discour
se/vendor/bundle/ruby/2.5.0/gems/redis-4.0.1/lib/redis/client.rb:219:in `block in process'", "/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/redis-4.0.1/lib/redis/client.rb:304:in `logging'", "/var/w
ww/discourse/vendor/bundle/ruby/2.5.0/gems/redis-4.0.1/lib/redis/client.rb:218:in `process'", "/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/redis-4.0.1/lib/redis/client.rb:118:in `call'", "/var/www
/discourse/vendor/bundle/ruby/2.5.0/gems/redis-4.0.1/lib/redis.rb:889:in `block in get'", "/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/redis-4.0.1/lib/redis.rb:45:in `block in synchronize'", "/usr
/local/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'", "/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/redis-4.0.1/lib/redis.rb:45:in `synchronize'", "/var/www/discourse/vendor/bundle/ruby/2.5.0
/gems/redis-4.0.1/lib/redis.rb:888:in `get'", "/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/message_bus-2.2.0.pre.1/lib/message_bus/backends/redis.rb:360:in `process_global_backlog'", "/var/www/dis
course/vendor/bundle/ruby/2.5.0/gems/message_bus-2.2.0.pre.1/lib/message_bus/backends/redis.rb:271:in `block in global_subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/message_bus-2.2.0.p
re.1/lib/message_bus/backends/redis.rb:284:in `global_subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/message_bus-2.2.0.pre.1/lib/message_bus.rb:721:in `global_subscribe_thread'", "/var/
www/discourse/vendor/bundle/ruby/2.5.0/gems/message_bus-2.2.0.pre.1/lib/message_bus.rb:669:in `block in new_subscriber_thread'"]
Job exception: Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED)

Job exception: Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED)

Job exception: Cannot assign requested address - connect(2) for [::1]:6379

Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED) subscribe failed, reconnecting in 1 second. Call stack ["/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/redis-4.0.1/lib/redis/client.
rb:344:in `rescue in establish_connection'", "/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/redis-4.0.1/lib/redis/client.rb:328:in `establish_connection'", "/var/www/discourse/vendor/bundle/ruby/2.5
.0/gems/redis-4.0.1/lib/redis/client.rb:99:in `block in connect'", "/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/redis-4.0.1/lib/redis/client.rb:291:in `with_reconnect'", "/var/www/discourse/vendor
/bundle/ruby/2.5.0/gems/redis-4.0.1/lib/redis/client.rb:98:in `connect'", "/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/redis-4.0.1/lib/redis/client.rb:363:in `ensure_connected'", "/var/www/discour
se/vendor/bundle/ruby/2.5.0/gems/redis-4.0.1/lib/redis/client.rb:219:in `block in process'", "/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/redis-4.0.1/lib/redis/client.rb:304:in `logging'", "/var/w
ww/discourse/vendor/bundle/ruby/2.5.0/gems/redis-4.0.1/lib/redis/client.rb:218:in `process'", "/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/redis-4.0.1/lib/redis/client.rb:118:in `call'", "/var/www
/discourse/vendor/bundle/ruby/2.5.0/gems/redis-4.0.1/lib/redis.rb:889:in `block in get'", "/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/redis-4.0.1/lib/redis.rb:45:in `block in synchronize'", "/usr
/local/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'", "/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/redis-4.0.1/lib/redis.rb:45:in `synchronize'", "/var/www/discourse/vendor/bundle/ruby/2.5.0
/gems/redis-4.0.1/lib/redis.rb:888:in `get'", "/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/message_bus-2.2.0.pre.1/lib/message_bus/backends/redis.rb:360:in `process_global_backlog'", "/var/www/dis
course/vendor/bundle/ruby/2.5.0/gems/message_bus-2.2.0.pre.1/lib/message_bus/backends/redis.rb:271:in `block in global_subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/message_bus-2.2.0.p
re.1/lib/message_bus/backends/redis.rb:284:in `global_subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/message_bus-2.2.0.pre.1/lib/message_bus.rb:721:in `global_subscribe_thread'", "/var/
www/discourse/vendor/bundle/ruby/2.5.0/gems/message_bus-2.2.0.pre.1/lib/message_bus.rb:669:in `block in new_subscriber_thread'"]
Job exception: Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED)

Anyone have a thought on this one? I’m stuck.

Thanks!

It wouldn’t hurt to give us some more information here:

  • OS
  • install method

Hey Steven.

I was trying to update the version of Discourse through the web GUI, but was prompted to do it via the terminal due to the container being out of date.

OS - Ubuntu 16.04 on an EC2 instance.
Install Method - I used the ./launcher rebuild app

Any thoughts on this?

Is redis running in your container? It appears not.

Redis is up. I get a PONG back.

Is it running inside the container or on your host?

It’s running inside the container.

I just ran ./discourse-doctor and no errors were thrown. Test email came through successfully.

Can you paste the output from ps axf from inside the container?

root@ip-172-30-0-15-app:/var/www/discourse# ps axf
  PID TTY      STAT   TIME COMMAND
13531 pts/1    Ss     0:00 /bin/bash --login
13541 pts/1    R+     0:00  \_ ps axf
    1 pts/0    Ss+    0:00 /bin/bash /sbin/boot
  282 pts/0    S+     0:00 /usr/bin/runsvdir -P /etc/service
  283 ?        Ss     0:00  \_ runsv cron
  290 ?        S      0:00  |   \_ cron -f
  284 ?        Ss     0:00  \_ runsv rsyslog
  296 ?        Sl     0:00  |   \_ rsyslogd -n
  285 ?        Ss     0:00  \_ runsv postgres
  294 ?        S      0:00  |   \_ svlogd /var/log/postgres
  295 ?        S      0:02  |   \_ /usr/lib/postgresql/10/bin/postmaster -D /etc/postgresql/10/main
  313 ?        Ss     0:00  |       \_ postgres: 10/main: checkpointer process
  314 ?        Ss     0:00  |       \_ postgres: 10/main: writer process
  315 ?        Ss     0:06  |       \_ postgres: 10/main: wal writer process
  316 ?        Ss     0:01  |       \_ postgres: 10/main: autovacuum launcher process
  317 ?        Ss     0:02  |       \_ postgres: 10/main: stats collector process
  318 ?        Ss     0:00  |       \_ postgres: 10/main: bgworker: logical replication launcher
  368 ?        Ss     0:00  |       \_ postgres: 10/main: discourse discourse [local] idle
  697 ?        Ss     0:00  |       \_ postgres: 10/main: discourse discourse [local] idle
  719 ?        Ss     0:00  |       \_ postgres: 10/main: discourse discourse [local] idle
13410 ?        Ss     0:00  |       \_ postgres: 10/main: discourse discourse [local] idle
  286 ?        Ss     0:00  \_ runsv redis
  292 ?        S      0:00  |   \_ svlogd /var/log/redis
  293 ?        Sl     1:46  |   \_ /usr/bin/redis-server *:6379
  287 ?        Ss     0:00  \_ runsv nginx
  291 ?        S      0:00  |   \_ nginx: master process /usr/sbin/nginx
  309 ?        S      0:00  |       \_ nginx: worker process
  310 ?        S      0:00  |       \_ nginx: cache manager process
  288 ?        Ss     0:00  \_ runsv unicorn
  289 ?        S      0:18      \_ /bin/bash config/unicorn_launcher -E production -c config/unicorn.conf.rb
  319 ?        Sl     0:53          \_ unicorn master -E production -c config/unicorn.conf.rb
  428 ?        SNl    2:53          |   \_ sidekiq 5.1.3 discourse [0 of 5 busy]
  454 ?        Sl     0:51          |   \_ unicorn worker[0] -E production -c config/unicorn.conf.rb
  476 ?        Sl     0:51          |   \_ unicorn worker[1] -E production -c config/unicorn.conf.rb
13540 ?        S      0:00          \_ sleep 1

There’s nothing I can see wrong. That looks like it should be working.

Is it still throwing the errors when you try and use it? Does ss -t show any redis connections?

Is there anything unusual done to the configuration?

1 Like

I see a bunch of established connections to Redis (6379). The only thing I did was follow the directions from the web GUI telling me to upgrade the container in order to update the Discourse version.

Hi there. Has anyone made any progress on this issue? Peering into my logs, I can see that Discourse (unicorn, specifically, I think) is having trouble connecting to redis. When I use the launcher to enter into the app, it pong’s back my redis-cli ping… so I’m not sure what’s up.

Anyone know what I can do?

Can you tell us a little bit about your setup if it’s different than the OP’s? Any info will help us troubleshoot.

1 Like