Skip to content

Redis::CannotConnectError: No sentinels available. #531

Closed
@palexvs

Description

@palexvs

Hello, I'm trying to setup sentinels, but i get error Redis::CannotConnectError: No sentinels available:

> redis = Redis.new(url: "redis://master.redis.com:6379/0", sentinels: [{host: "127.0.0.1", port: 26379}], master_name: :master)
> redis.zcount(1,0,'+inf')

Error:

Redis::CannotConnectError: No sentinels available.
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/client.rb:551:in `sentinel_detect'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/client.rb:555:in `resolve_master'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/client.rb:519:in `resolve'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/client.rb:317:in `establish_connection'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/client.rb:94:in `block in connect'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/client.rb:279:in `with_reconnect'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/client.rb:93:in `connect'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/client.rb:350:in `ensure_connected'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/client.rb:207:in `block in process'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/client.rb:292:in `logging'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/client.rb:206:in `process'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis/client.rb:112:in `call'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/newrelic-redis-2.0.2/lib/newrelic_redis/instrumentation.rb:36:in `block in call_with_newrelic_trace'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/datastores.rb:111:in `block in wrap'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/method_tracer.rb:69:in `block in trace_execution_scoped'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/method_tracer_helpers.rb:82:in `trace_execution_scoped'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/method_tracer.rb:67:in `trace_execution_scoped'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.12.0.288/lib/new_relic/agent/datastores.rb:108:in `wrap'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/newrelic-redis-2.0.2/lib/newrelic_redis/instrumentation.rb:35:in `call_with_newrelic_trace'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis.rb:1769:in `block in zcount'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis.rb:37:in `block in synchronize'
  from /opt/rbenv/versions/2.2.2/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis.rb:37:in `synchronize'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/redis-3.2.1/lib/redis.rb:1768:in `zcount'
  from (irb):66
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/railties-4.1.10/lib/rails/commands/console.rb:90:in `start'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/railties-4.1.10/lib/rails/commands/console.rb:9:in `start'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/railties-4.1.10/lib/rails/commands/commands_tasks.rb:69:in `console'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/railties-4.1.10/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
  from /home/rails/project/shared/bundle/ruby/2.2.0/gems/railties-4.1.10/lib/rails/commands.rb:17:in `<top (required)>'
  from ./bin/rails:8:in `require'
  from ./bin/rails:8:in `<main>'irb(main):067:0> 

But sentinel exists:

# redis-cli -p 26379
127.0.0.1:26379> info
# Server
redis_version:3.0.1
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:8114b371efa78b51
redis_mode:sentinel
os:Linux 3.13.0-24-generic x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.8.2
process_id:1130
run_id:2f09b36efcc4c99f94f5b9ed6d06ff52b61b78bb
tcp_port:26379
uptime_in_seconds:3884
uptime_in_days:0
hz:12
lru_clock:6879962
config_file:/etc/redis/redis.conf

# Sentinel
sentinel_masters:1
sentinel_tilt:0
sentinel_running_scripts:0
sentinel_scripts_queue_length:0
master0:name=master,status=ok,address=10.0.0.1:6379,slaves=1,sentinels=1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions