【问题标题】:How can I create a service name and password in redis-sentinel如何在 redis-sentinel 中创建服务名称和密码
【发布时间】:2020-07-21 21:37:48
【问题描述】:

我在运行 celery beat -S redbeat.RedBeatScheduler 时收到此错误。

beat 引发异常:ConnectionError('Error -2 connected to redis-sentinel:26379. Name or service not known.',)

如何在 redis-sentinel 中创建 service_name 和密码 我没有尝试将 redis 用作消息代理。我正在使用 celery-redbeat 从这个页面将 celerybeat 数据存储在 redis-sentinel 集群中。https://pypi.org/project/celery-redbeat/

从此配置

redbeat_redis_url = 'redis-sentinel://redis-sentinel:26379/0'
redbeat_redis_options = {
    'sentinels': [('192.168.1.1', 26379),
                  ('192.168.1.2', 26379),
                  ('192.168.1.3', 26379)],
    'socket_timeout': 0.1,
}

我添加了 192.168.1.1:26379 而不是 redis-sentinel:/26379 但是当主节点在 redis-sentinel 集群中关闭时,节拍也关闭了。

redbeat_redis_url = 'redis-sentinel://192.168.1.1:26379/0'
redbeat_redis_options = {
    'sentinels': [('192.168.1.2', 26379),
                  ('192.168.1.3', 26379)],
    'socket_timeout': 0.1,
}

【问题讨论】:

    标签: redis celery sentinel redis-sentinel


    【解决方案1】:

    除非您的 /etc/hosts 文件中有 redis-sentinel,否则它将无法将其解析为正确的 IP 地址。您可以尝试将 redis-sentinel 替换为您的 Redis 服务器的 IP 地址。此外,它看起来不像是正确的 Redis Sentinel 配置。 Redis Configuration 部分解释了如何连接到 Redis Sentinel,请阅读。

    【讨论】:

    • 我正在尝试使用此页面 pypi.org/project/celery-redbeat 中的 celery-redbeat,并且我正在尝试使用此配置
    • redbeat_redis_url= 'redis-sentinel://redis-sentinel:26379/0' redbeat_redis_options = { 'sentinels': [('192.168.1.1', 26379), ('192.168.1.2', 26379), ('192.168.1.3', 26379)], 'password': '123', 'service_name': 'master', 'socket_timeout': 0.1, }
    • 请阅读我没有使用 redis 作为消息代理。我正在尝试将节拍文件存储在 redis-sentinel 集群中。
    猜你喜欢
    • 2020-01-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-12
    • 1970-01-01
    • 1970-01-01
    • 2017-05-01
    • 2015-07-16
    相关资源
    最近更新 更多