How to solve Redis::CannotConnectError: Error connecting to Redis on 127.0.0.1:6379? Question
I tried to setup a local QPixel instance (WSL - Ubuntu 20.04) and followed the guide by luap42.
I finally run rails -s
and got
/var/lib/gems/2.7.0/gems/fileutils-1.6.0/lib/fileutils.rb:105: warning: previous definition of VERSION was here
/usr/lib/ruby/2.7.0/fileutils.rb:1284: warning: already initialized constant FileUtils::Entry_::S_IF_DOOR
/var/lib/gems/2.7.0/gems/fileutils-1.6.0/lib/fileutils.rb:1269: warning: previous definition of S_IF_DOOR was here
/usr/lib/ruby/2.7.0/fileutils.rb:1568: warning: already initialized constant FileUtils::Entry_::DIRECTORY_TERM
/var/lib/gems/2.7.0/gems/fileutils-1.6.0/lib/fileutils.rb:1557: warning: previous definition of DIRECTORY_TERM was here
/usr/lib/ruby/2.7.0/fileutils.rb:1626: warning: already initialized constant FileUtils::OPT_TABLE
/var/lib/gems/2.7.0/gems/fileutils-1.6.0/lib/fileutils.rb:1615: warning: previous definition of OPT_TABLE was here
/usr/lib/ruby/2.7.0/fileutils.rb:1685: warning: already initialized constant FileUtils::LOW_METHODS
/var/lib/gems/2.7.0/gems/fileutils-1.6.0/lib/fileutils.rb:1674: warning: previous definition of LOW_METHODS was here
/usr/lib/ruby/2.7.0/fileutils.rb:1692: warning: already initialized constant FileUtils::METHODS
/var/lib/gems/2.7.0/gems/fileutils-1.6.0/lib/fileutils.rb:1681: warning: previous definition of METHODS was here
[Coveralls] Set up the SimpleCov formatter.
[Coveralls] Using SimpleCov's 'rails' settings.
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.6/lib/active_support/cache.rb:445: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.6/lib/active_support/cache.rb:716: warning: The called method `initialize' is defined here
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/actionpack-5.2.6/lib/action_dispatch/middleware/stack.rb:37: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/actionpack-5.2.6/lib/action_dispatch/middleware/static.rb:111: warning: The called method `initialize' is defined here
Run options: --seed 10687
# Running:
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activerecord-5.2.6/lib/active_record/associations.rb:1855: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activerecord-5.2.6/lib/active_record/associations.rb:1368: warning: The called method `has_many' is defined here
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/mysql/database_statements.rb:12: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/query_cache.rb:95: warning: The called method `select_all' is defined here
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activemodel-5.2.6/lib/active_model/type/integer.rb:13: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activemodel-5.2.6/lib/active_model/type/value.rb:8: warning: The called method `initialize' is defined here
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:171: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:97: warning: The called method `initialize' is defined here
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activerecord-5.2.6/lib/active_record/transactions.rb:212: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:260: warning: The called method `transaction' is defined here
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:146: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:97: warning: The called method `initialize' is defined here
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activerecord-5.2.6/lib/active_record/relation/delegation.rb:132: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activerecord-5.2.6/lib/active_record/relation.rb:25: warning: The called method `initialize' is defined here
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activemodel-5.2.6/lib/active_model/naming.rb:190: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/i18n-1.8.11/lib/i18n.rb:196: warning: The called method `translate' is defined here
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activemodel-5.2.6/lib/active_model/translation.rb:67: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/i18n-1.8.11/lib/i18n.rb:196: warning: The called method `translate' is defined here
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activemodel-5.2.6/lib/active_model/errors.rb:430: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/i18n-1.8.11/lib/i18n.rb:196: warning: The called method `translate' is defined here
./home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activerecord-5.2.6/lib/active_record/persistence.rb:705: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/home/abanta/qpixel/vendor/bundle/ruby/2.7.0/gems/activerecord-5.2.6/lib/active_record/timestamp.rb:105: warning: The called method `_update_record' is defined here
.......E
Error:
PostHistoryControllerTest#test_should_get_post_history_page:
Redis::CannotConnectError: Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED)
app/helpers/application_helper.rb:151:in `read_only?'
app/controllers/application_controller.rb:314:in `read_only_mode?'
test/controllers/post_history_controller_test.rb:7:in `block in <class:PostHistoryControllerTest>'
bin/rails test test/controllers/post_history_controller_test.rb:6
.E
Error:
AdminControllerTest#test_should_get_index:
Redis::CannotConnectError: Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED)
app/helpers/application_helper.rb:151:in `read_only?'
app/controllers/application_controller.rb:314:in `read_only_mode?'
test/controllers/admin_controller_test.rb:10:in `block in <class:AdminControllerTest>'
bin/rails test test/controllers/admin_controller_test.rb:8
E
Error:
AdminControllerTest#test_should_grant_global_admins_access_to_non_admin_community:
Redis::CannotConnectError: Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED)
app/helpers/application_helper.rb:151:in `read_only?'
app/controllers/application_controller.rb:314:in `read_only_mode?'
test/controllers/admin_controller_test.rb:75:in `block (2 levels) in <class:AdminControllerTest>'
test/controllers/admin_controller_test.rb:74:in `each'
test/controllers/admin_controller_test.rb:74:in `block in <class:AdminControllerTest>'
bin/rails test test/controllers/admin_controller_test.rb:67
at which point I interruppted the process. There is an error Redis::CannotConnectError: Error connecting to Redis on 127.0.0.1:6379
which hints that I did not configure redis correctly. But how do I do that?
My config\database.yml
content is identical with config\database.sample.yml
except for the default username and password.
What would I have to do on a Ubuntu to get Redis running and QPixel being able to connect to Redis that isn't already mentioned in the guide.
1 answer
Likely Redis server is not running. Start with sudo systemctl start redis-server.service
or with sudo service redis-server start
or with redis-server
.
Check with redis-cli
and inserting "ping" in the prompt, receiving "PONG".
See for example Redis Quickstart or How to install and configure Redis on Ubuntu 20.04.
0 comment threads