The user nick7 reports issues with a fresh Discourse installation on Ubuntu 16.04, experiencing Redis connection errors in the production log, despite Redis appearing to run normally. The error Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED) prevents the app from connecting, though email sending works. The user confirms the issue occurs on a fresh DigitalOcean droplet with a standard installation process. mpalmer questions whether Redis is failing to start, while miromichalicka suggests the problem might be Ubuntu-specific, as it works on 17.04. nick7 provides Redis logs showing it starts successfully and saves data. majestic confirms the same issue on AWS EC2 with Ubuntu 16.04, and n1bff notes similar errors on Ubuntu 18.04 without functional issues. The discussion centers on whether the Redis connection errors are benign or indicative of a deeper problem, particularly in Ubuntu 16.04 environments.
I tried to create new installation on new VPS, but get logs below in shared/standalone/log/rails/production.log (and probably this is why i cant send email trough smtp).
So, i checked same on DigitalOcean Ubuntu 16 droplet, same results.
Installation commands i use (like in discourse basic install):
wget -qO- https://get.docker.com/ | sh
mkdir /var/discourse
git clone https://github.com/discourse/discourse_docker.git /var/discourse
cd /var/discourse
./discourse-setup
Wait 5 seconds and setup create 2GB SWAP by himself
Set smtp credentials
Thats all
Logs from shared/standalone/log/rails/production.log:
Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED) subscribe failed, reconnecting in 1 second. Call stack ["/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.5/lib/redis/client.rb:345:in `rescue in establish_connection'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.5/lib/redis/client.rb:331:in `establish_connection'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.5/lib/redis/client.rb:101:in `block in connect'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.5/lib/redis/client.rb:293:in `with_reconnect'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.5/lib/redis/client.rb:100:in `connect'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.5/lib/redis/client.rb:364:in `ensure_connected'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.5/lib/redis/client.rb:221:in `block in process'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.5/lib/redis/client.rb:306:in `logging'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.5/lib/redis/client.rb:220:in `process'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.5/lib/redis/client.rb:120:in `call'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.5/lib/redis.rb:862:in `block in get'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.5/lib/redis.rb:58:in `block in synchronize'", "/usr/local/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.5/lib/redis.rb:58:in `synchronize'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/redis-3.3.5/lib/redis.rb:861:in `get'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/message_bus-2.1.2/lib/message_bus/backends/redis.rb:284:in `process_global_backlog'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/message_bus-2.1.2/lib/message_bus/backends/redis.rb:320:in `block in global_subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/message_bus-2.1.2/lib/message_bus/backends/redis.rb:333:in `global_subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/message_bus-2.1.2/lib/message_bus.rb:525:in `global_subscribe_thread'", "/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/message_bus-2.1.2/lib/message_bus.rb:473:in `block in new_subscriber_thread'"]`
50:M 13 Jan 18:14:12.422 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
50:M 13 Jan 18:14:12.422 # Server started, Redis version 3.0.6
50:M 13 Jan 18:14:12.422 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
50:M 13 Jan 18:14:12.422 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
50:M 13 Jan 18:14:12.428 * DB loaded from disk: 0.006 seconds
50:M 13 Jan 18:14:12.428 * The server is now ready to accept connections on port 6379
50:M 13 Jan 18:19:13.039 * 10 changes in 300 seconds. Saving...
50:M 13 Jan 18:19:13.042 * Background saving started by pid 1103
1103:C 13 Jan 18:19:13.058 * DB saved on disk
....
46:M 14 Jan 06:30:50.121 * Background saving terminated with success
46:M 14 Jan 06:35:51.078 * 10 changes in 300 seconds. Saving...
46:M 14 Jan 06:35:51.079 * Background saving started by pid 10074
10074:C 14 Jan 06:35:51.092 * DB saved on disk
10074:C 14 Jan 06:35:51.093 * RDB: 0 MB of memory used by copy-on-write
46:M 14 Jan 06:35:51.179 * Background saving terminated with success
46:M 14 Jan 06:40:52.042 * 10 changes in 300 seconds. Saving...
46:M 14 Jan 06:40:52.042 * Background saving started by pid 10393
10393:C 14 Jan 06:40:52.056 * DB saved on disk
10393:C 14 Jan 06:40:52.057 * RDB: 0 MB of memory used by copy-on-write
46:M 14 Jan 06:40:52.142 * Background saving terminated with success
Ok, so, email sending and this errors in log different things, you can get this errors in production.log after rebuild app and wait are while6 and than will be reproduced periodically.
So… Redis is running, but the app can’t connect? Are you running an all-in-one (standalone) setup with everything in one container, or split out somehow? Any non-default firewall/security things going on?