Discourse with Redis Cluster mode

Hello,

I am trying to connect Discourse with Redis cache cluster. I have multiple nodes in my redis cluster. I get following error in log.

“CROSSSLOT Keys in request don’t hash to the same slot (Redis::CommandError)”

As per Redis guidelines:

When in cluster mode, Redis do not support multi-key operations where keys falls to the different key slots.
“Redis Cluster implements all the single key commands available in the non-distributed version of Redis. Commands performing complex multi-key operations like Set type unions or intersections are implemented as well as long as the keys all belong to the same node.”

I can see many of the redis operations in Discourse involves multi key operations. Find one such example as below. Does this mean that Discourse won’t be able to connect to redis in cluster mode? Are we limited to host Discourse with only one instance of redis in non cluster mode?

https://github.com/discourse/discourse/blob/master/lib/discourse_redis.rb#L193

Any help would be greatly appreciated.

2 Likes

No chance this will work, we use eval and on a cluster that can not work

2 Likes

mhm, it is a pity.
Just have run into a similar issue with an AWS Redis elasticache cluster while rebuilding the www app.
I, [2017-10-12T21:12:38.058320 #13] INFO – : > cd /var/www/discourse && su discourse -c ‘bundle exec rake db:migrate’
URGENT: MOVED 1326 172.25.11.156:6379 Failed to initialize site default
rake aborted!
Redis::CommandError: MOVED 6976 172.25.11.156:6379

The Redis cluster is running on 4 nodes. Would be nice to get this solved.

dig +short my-redis-cluster.clustercfg.euc1.cache.amazonaws.com
172.25.11.156
172.25.11.169
172.25.11.8
172.25.11.104
1 Like

This is not going to be solved, just run slaves if you need HA, then you fail over to slave if master explodes

2 Likes