【问题标题】:Setting password for Redis Ruby Client为 Redis Ruby 客户端设置密码
【发布时间】:2020-08-04 13:38:30
【问题描述】:

我正在尝试由 Redis 的创建者使用 these ruby clients 测试我的 集群。但我不断收到以下错误:

错误无法到达单个启动节点。需要 NOAUTH 身份验证

我试过了:

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')=

这些变化似乎都不起作用。我使用的密码没有错误。我可以使用相同的密码登录redis-cli

在这方面的任何帮助都会有很大帮助。

谢谢。

【问题讨论】:

  • 这个gem好像不支持通过密码获取redis连接github.com/antirez/redis-rb-cluster/blob/master/cluster.rb#L43
  • 我刚刚想通了。存储库中的示例代码是 example.rbconsistency-test.rb 使用创建客户端的旧方法,但它不起作用。但是您链接的那个使用了正确的那个,我们可以将密码传递给它。请参阅下面的答案

标签: ruby redis redis-cluster


【解决方案1】:

示例是旧客户端代码。 经过几个小时的辛勤工作,我发现以下工作:

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

如果文档能更新就好了。我为官方 Redis 文档中的示例创建了一个 issue on the github page

希望它会得到更新。

【讨论】:

    猜你喜欢
    • 2014-04-04
    • 2019-10-16
    • 2021-06-13
    • 1970-01-01
    • 1970-01-01
    • 2017-11-19
    • 2018-03-23
    • 2021-06-18
    • 2016-03-03
    相关资源
    最近更新 更多