Quantcast
Channel: Active questions tagged redis+ruby-on-rails - Stack Overflow
Viewing all articles
Browse latest Browse all 873

Rails cache redis with TLS - Server closed the connection (EOFError)

$
0
0

I am using Digital Ocean managed Redis 7 database but I cannot connect.

The url is:ENV.fetch("REDIS_CACHE_URL")

rediss://default:password@redis-cache-do-user-id.b.db.ondigitalocean.com:25061/0" 

config

config.cache_store = :redis_cache_store, {  driver: :hiredis,   url: ENV.fetch("REDIS_CACHE_URL") { "redis://localhost:6379/1" },  :ssl => true,  ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE },}

Caching return false

Rails.cache.write('test', 1) => false

Rails.cache.stats

/Users/name/.rvm/gems/ruby-3.1.2/gems/redis-4.7.1/lib/redis/client.rb:306:in `rescue in io': Connection lost (ECONNRESET) (Redis::ConnectionError)/Users/name/.rvm/gems/ruby-3.1.2/gems/hiredis-0.6.3/lib/hiredis/ext/connection.rb:21:in `rescue in read': Connection reset by peer (Errno::ECONNRESET)/Users/name/.rvm/gems/ruby-3.1.2/gems/hiredis-0.6.3/lib/hiredis/ext/connection.rb:19:in `read': Server closed the connection (EOFError)

Redis cache exists?

> redis = Redis.new(url: ENV.fetch("REDIS_CACHE_URL")) => #<Redis client v4.7.1 for rediss://redis-cache-do-user-id-0.b.db.... > redis.exists?("some_key")/Users/name/.rvm/gems/ruby-3.1.2/gems/redis-4.7.1/lib/redis/client.rb:306:in `rescue in io': Connection lost (ECONNRESET) (Redis::ConnectionError)/Users/name/.rvm/gems/ruby-3.1.2/gems/hiredis-0.6.3/lib/hiredis/ext/connection.rb:21:in `rescue in read': Connection reset by peer (Errno::ECONNRESET)/Users/name/.rvm/gems/ruby-3.1.2/gems/hiredis-0.6.3/lib/hiredis/ext/connection.rb:19:in `read': Server closed the connection (EOFError)

I can correctly connect to redis-cli from the same machine (localhost)

redis-cli --tls -h redis-cache-do-user-id-0.b.db.ondigitalocean.com -a XXXXXXXXXX -p 25061Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.redis-cache-do-user-id-0.b.db.ondigitalocean.com:25061> KEYS *1) "test"redis-cache-do-user-id-0.b.db.ondigitalocean.com:25061> 

Using other vendor (like RedisLabs) it works. So maybe the issue is something related to connecting from Rails using TLS.


Viewing all articles
Browse latest Browse all 873

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>