frappe / bench

CLI to manage Multi-tenant deployments for Frappe apps
https://frappeframework.com/docs/user/en/bench
GNU General Public License v3.0
1.39k stars 1.2k forks source link

CROSSSLOT Error when using external Redis Cluster (AWS Elasticache) #1461

Closed philginconquest closed 9 months ago

philginconquest commented 1 year ago

First, I tried using the same cluster for cache, queue and socketio but I got the error so I tried creating a separate cluster for each but I still got the same error.

ERPNext 14 develop

here's a screenshot fo the redis setting on common_site_config.json

Screenshot 2023-06-19 at 9 23 19 PM

here's the tail of the error:

fa\x12\x1b\n)V\xff\x97+C\xd5bX\xfa[\x7f\xf3po\xefV\xab\xc5\x93\xf0<\xa06\xf8\x16\x1b\xf9\xe0\xd9no\xf2\x06\xe5 \x85D}\x03\x0b\x01j.\r\n$21\r\nsuccess_cal...
      errors = []
      i = 3
      command = (('RPUSH', 'rq:queue:opt-bitnami-erpnext-frappe-bench:long', 'd5016c48-f355-4a35-b8cc-9363152854d2'), {})
  File "/opt/bitnami/erpnext/frappe-bench/env/lib/python3.10/site-packages/redis/client.py", line 3977, in parse_response
    result = Redis.parse_response(
      self = Pipeline<ConnectionPool<Connection<host=xxxx-redis.xxxx.clustercfg.use1.cache.amazonaws.com,port=6379,db=0>>>
      connection = Connection<host=xxxx-redis.xxxx.clustercfg.use1.cache.amazonaws.com,port=6379,db=0>
      command_name = '_'
      options = {}
  File "/opt/bitnami/erpnext/frappe-bench/env/lib/python3.10/site-packages/redis/client.py", line 915, in parse_response
    response = connection.read_response()
      self = Pipeline<ConnectionPool<Connection<host=xxxx-redis.xxxx.clustercfg.use1.cache.amazonaws.com,port=6379,db=0>>>
      connection = Connection<host=xxxx-redis.xxxx.clustercfg.use1.cache.amazonaws.com,port=6379,db=0>
      command_name = '_'
      options = {}
  File "/opt/bitnami/erpnext/frappe-bench/env/lib/python3.10/site-packages/redis/connection.py", line 756, in read_response
    raise response
      self = Connection<host=xxxx-redis.xxxxx.clustercfg.use1.cache.amazonaws.com,port=6379,db=0>
      response = ResponseError("CROSSSLOT Keys in request don't hash to the same slot")
redis.exceptions.ResponseError: CROSSSLOT Keys in request don't hash to the same slot
KevinFaro commented 9 months ago

Have a look here: https://repost.aws/knowledge-center/elasticache-crossslot-keys-error-redis

Essentially, Frappe does not support clustered Redis. You need to create the cache with cluster mode disabled: https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Replication.Redis-RedisCluster.html

ankush commented 9 months ago

We don't support elasticcache / clusters. We have never found Redis to be a bottleneck... ever. :sweat_smile: