Redis Pfcount in Cluster Mode

11 views
Skip to first unread message

Salih Saglam

unread,
Oct 2, 2018, 9:44:59 AM10/2/18
to Redis DB
I have following error, Redis forces me to count keys at same node. Is there a new and modern way to handle this lack feature in Redis?
org.springframework.dao.InvalidDataAccessApiUsageException: All keys must map to same slot for pfcount in cluster mode.
        at org.springframework.data.redis.connection.jedis.JedisClusterConnection.pfCount(JedisClusterConnection.java:3610)
        at org.springframework.data.redis.core.DefaultHyperLogLogOperations$2.doInRedis(DefaultHyperLogLogOperations.java:68)
        at org.springframework.data.redis.core.DefaultHyperLogLogOperations$2.doInRedis(DefaultHyperLogLogOperations.java:64)
        at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:207)
        at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:169)
        at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:91)
        at org.springframework.data.redis.core.DefaultHyperLogLogOperations.size(DefaultHyperLogLogOperations.java:64)

```Spring Source COde:

@Override
   public long countAll(List<String> keys) {
      StopWatch stopWatch = new StopWatch();
      stopWatch.start();
      LOGGER.debug("Calculating keys -> {} ", keys);
      long size = 0;
      try {
         size = hyperLogLogOperations.size(keys.toArray(new String[0]));
         redisInTrouble = false;
      } catch (Exception e) {
         LOGGER.error("Having Redis Error with key: {}", keys, e);
         redisInTrouble = true;
      } finally {
         metricObserver.observe(SummaryMetric.REDIS_RESPONSE_PFCOUNT_TIME, stopWatch.getTotalTimeMillis());
         stopOrStartKafkaUpOnRedisError();
      }
      return size;
   }
Here is redis-cli prompt:

172.18.182.82:6379> pfcount XMPP-LI-09270934
(integer) 4
172.18.182.82:6379> pfcount XMPP-LI-09270936
(error) MOVED 3842 172.18.182.82:7379
172.18.182.82:6379> pfcount XMPP-LI-09270936 XMPP-LI-09270934
(error) CROSSSLOT Keys in request don't hash to the same slot

Reply all
Reply to author
Forward
0 new messages