Search code examples
rubyredisredis-cluster

Setting password for Redis Ruby Client


I am trying to test my cluster using these ruby clients by the creator of Redis itself. But I constantly get the following error:

error Can't reach a single startup node. NOAUTH Authentication required

I have tried:

startup_nodes = [
        {:host => "redis-cluster-service", :port => 6379, :password => 'pass'}
    ]

startup_nodes = [
        {:host => "redis-cluster-service", :port => 6379, password: 'pass'}
    ]

RedisCluster.new(startup_nodes,32,:timeout => 0.1,:password => 'pass')
RedisCluster.new(startup_nodes,32,:timeout => 0.1, password: 'pass')
RedisCluster.new(startup_nodes,32,:timeout => 0.1,:auth_pass => 'pass')=

None of these variations seem to work. There is no error with the password I am using. I can log into the redis-cli using the same password.

Any help with regards to this would be of great help.

Thank you.


Solution

  • The example is of the old client code,. After hours of toil I found that the following works:

    rc = Redis.new(cluster: startup_nodes,:timeout => 0.1, replica: true, password: 'PASSWORD')
    

    Would be nice if the docs were updated. I had created an issue on the github page for the examples in the offcial Redis docs.

    Hopefully it will get updated.