【问题标题】:AWS + Celery + ElastiCache (Redis Cluster) Error: CROSSSLOT Keys in request don't hash to the same slotAWS + Celery + ElastiCache(Redis 集群)错误:请求中的 CROSSSLOT 键不会散列到同一个插槽
【发布时间】:2018-10-29 06:33:25
【问题描述】:

我有一个在 AWS 上工作的 Dockerized Celery,它使用来自 AWS 的 ElastiCache(具有多节点的 Redis 集群)作为消息代理,但我收到以下错误。

当我在本地机器上测试我的 Celery worker 时,它与单节点 Redis 通信完全正常。我应该如何解决这个问题?

[I 180518 18:54:20 mixins:224] Connected to redis://....use1.cache.amazonaws.com:6379//

[E 180518 18:54:20 events:123] Failed to capture events: 'CROSSSLOT Keys in request don't hash to the same slot', trying again in 1 seconds.

...

[E 180518 18:54:23 events:123] Failed to capture events: 'Command # 1 (LLEN celeryev....2d788) of pipeline caused error: MOVED 11904 10.0.x.xxx:6379', trying again in 1 seconds.

【问题讨论】:

    标签: amazon-web-services redis celery amazon-elasticache


    【解决方案1】:

    出现此错误是因为键必须在同一个哈希槽中,而不仅仅是同一个节点。要在分片 Redis(启用集群模式)ElastiCache 集群中实现多键操作,键必须散列到相同的散列槽。您可以使用哈希标签将密钥强制放入同一个哈希槽中。

    我还建议检查您的应用程序是否支持使用集群模式的 Redis

    更多信息herehere

    【讨论】:

      猜你喜欢
      • 2023-03-10
      • 2019-07-07
      • 2022-10-20
      • 2021-02-05
      • 1970-01-01
      • 2019-09-12
      • 2018-05-03
      • 2019-07-13
      • 2018-06-22
      相关资源
      最近更新 更多