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

How to connect to elastic cache in rails

$
0
0

I am looking for a way to connect the rails application to elastic cache for storing the cache. For testing purpose I try to test with redis-cli which is working fine. Is there any library or documentation available to connect to elastic cache. I already try to search but no luck

redis-cli -h primary-endpoint --tls -p 6379 -a "token"

I tried with redis-rails gem with the following code but it didn't work

REDIS_CONFIG = { "url"=>"primary_endpoint","cache_database"=>1,"sidekiq_database"=>0,"token_database"=>3,"role"=>"master","port"=>6379,"host1"=>"host1","host2"=>"host2","host3"=>"host3","namespace"=>"ac ac_integration" }@redis_token_store ||= Redis.new(REDIS_CONFIG)@redis_token_store.set(1, "2")

I get the following error

/usr/local/bundle/gems/redis-4.0.1/lib/redis/client.rb:344:in `rescue in establish_connection': Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED) (Redis::CannotConnectError)/usr/local/lib/ruby/3.0.0/socket.rb:1214:in `__connect_nonblock': Connection refused - connect(2) for 127.0.0.1:6379 (Errno::ECONNREFUSED)/usr/local/lib/ruby/3.0.0/socket.rb:1214:in `__connect_nonbloc: Operation now in progress - connect(2) would block (IO::EINPROGRESSWaitWritable)

Also, not sure how to passed the token in the configuration


Viewing all articles
Browse latest Browse all 873

Trending Articles



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