# Error connecting to Redis on localhost - Rebuilt

**URL:** https://meta.discourse.org/t/error-connecting-to-redis-on-localhost-rebuilt/107457
**Category:** Self-hosting
**Created:** [January 24, 2019, 8:29pm UTC](https://meta.discourse.org/t/error-connecting-to-redis-on-localhost-rebuilt/107457 "2019-01-24T20:29:00Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![Nopsled](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nopsled/32/120092_2.png) [@Nopsled](https://meta.discourse.org/u/Nopsled)
#### Post date: [January 24, 2019, 8:29pm UTC](https://meta.discourse.org/t/error-connecting-to-redis-on-localhost-rebuilt/107457/1 "2019-01-24T20:29:00Z")

</div>

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.

```plaintext
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)

```

---

<div class="post-metadata">

### Author: ![Nopsled](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nopsled/32/120092_2.png) [@Nopsled](https://meta.discourse.org/u/Nopsled)
#### Post date: [January 25, 2019, 3:25am UTC](https://meta.discourse.org/t/error-connecting-to-redis-on-localhost-rebuilt/107457/2 "2019-01-25T03:25:45Z")

</div>

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

Thanks!

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [January 25, 2019, 3:46am UTC](https://meta.discourse.org/t/error-connecting-to-redis-on-localhost-rebuilt/107457/3 "2019-01-25T03:46:16Z")

</div>

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

- OS
- install method

---

<div class="post-metadata">

### Author: ![Nopsled](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nopsled/32/120092_2.png) [@Nopsled](https://meta.discourse.org/u/Nopsled)
#### Post date: [January 25, 2019, 3:49am UTC](https://meta.discourse.org/t/error-connecting-to-redis-on-localhost-rebuilt/107457/4 "2019-01-25T03:49:25Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Nopsled](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nopsled/32/120092_2.png) [@Nopsled](https://meta.discourse.org/u/Nopsled)
#### Post date: [January 25, 2019, 4:11pm UTC](https://meta.discourse.org/t/error-connecting-to-redis-on-localhost-rebuilt/107457/5 "2019-01-25T16:11:30Z")

</div>

Any thoughts on this?

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [January 25, 2019, 4:20pm UTC](https://meta.discourse.org/t/error-connecting-to-redis-on-localhost-rebuilt/107457/6 "2019-01-25T16:20:53Z")

</div>

Is redis running in your container? It appears not.

---

<div class="post-metadata">

### Author: ![Nopsled](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nopsled/32/120092_2.png) [@Nopsled](https://meta.discourse.org/u/Nopsled)
#### Post date: [January 25, 2019, 4:26pm UTC](https://meta.discourse.org/t/error-connecting-to-redis-on-localhost-rebuilt/107457/7 "2019-01-25T16:26:58Z")

</div>

Redis is up. I get a PONG back.

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [January 25, 2019, 4:41pm UTC](https://meta.discourse.org/t/error-connecting-to-redis-on-localhost-rebuilt/107457/8 "2019-01-25T16:41:58Z")

</div>

Is it running _inside_ the container or on your host?

---

<div class="post-metadata">

### Author: ![Nopsled](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nopsled/32/120092_2.png) [@Nopsled](https://meta.discourse.org/u/Nopsled)
#### Post date: [January 25, 2019, 4:42pm UTC](https://meta.discourse.org/t/error-connecting-to-redis-on-localhost-rebuilt/107457/9 "2019-01-25T16:42:34Z")

</div>

It’s running inside the container.

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

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [January 25, 2019, 4:43pm UTC](https://meta.discourse.org/t/error-connecting-to-redis-on-localhost-rebuilt/107457/10 "2019-01-25T16:43:06Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Nopsled](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nopsled/32/120092_2.png) [@Nopsled](https://meta.discourse.org/u/Nopsled)
#### Post date: [January 25, 2019, 4:44pm UTC](https://meta.discourse.org/t/error-connecting-to-redis-on-localhost-rebuilt/107457/11 "2019-01-25T16:44:30Z")

</div>

```plaintext
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

```

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [January 25, 2019, 4:54pm UTC](https://meta.discourse.org/t/error-connecting-to-redis-on-localhost-rebuilt/107457/12 "2019-01-25T16:54:01Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Nopsled](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nopsled/32/120092_2.png) [@Nopsled](https://meta.discourse.org/u/Nopsled)
#### Post date: [January 25, 2019, 4:57pm UTC](https://meta.discourse.org/t/error-connecting-to-redis-on-localhost-rebuilt/107457/13 "2019-01-25T16:57:30Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![bcartwri96](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bcartwri96/32/129934_2.png) [@bcartwri96](https://meta.discourse.org/u/bcartwri96)
#### Post date: [January 29, 2020, 7:34am UTC](https://meta.discourse.org/t/error-connecting-to-redis-on-localhost-rebuilt/107457/14 "2020-01-29T07:34:24Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [January 29, 2020, 11:45am UTC](https://meta.discourse.org/t/error-connecting-to-redis-on-localhost-rebuilt/107457/15 "2020-01-29T11:45:17Z")

</div>

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