Redis

是否可以在 redis 6.0+ 中列出所有組

  • January 19, 2022

現在我在我的應用程序中遇到了一個問題,如下所示:

Caused by: redis.clients.jedis.exceptions.JedisDataException: NOGROUP No such key 'pydolphin:stream:article' or consumer group 'pydolphin:stream:group:article' in XREADGROUP with GROUP option
   at redis.clients.jedis.Protocol.processError(Protocol.java:135) ~[jedis-3.6.0.jar!/:?]
   at redis.clients.jedis.Protocol.process(Protocol.java:169) ~[jedis-3.6.0.jar!/:?]
   at redis.clients.jedis.Protocol.read(Protocol.java:223) ~[jedis-3.6.0.jar!/:?]
   at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:352) ~[jedis-3.6.0.jar!/:?]
   at redis.clients.jedis.Connection.getBinaryMultiBulkReply(Connection.java:304) ~[jedis-3.6.0.jar!/:?]
   at redis.clients.jedis.BinaryJedis.xreadGroup(BinaryJedis.java:4781) ~[jedis-3.6.0.jar!/:?]
   at org.springframework.data.redis.connection.jedis.JedisStreamCommands.lambda$xReadGroup$17(JedisStreamCommands.java:364) ~[spring-data-redis-2.5.0.jar!/:2.5.0]
   at org.springframework.data.redis.connection.jedis.JedisConnection.lambda$doInvoke$2(JedisConnection.java:176) ~[spring-data-redis-2.5.0.jar!/:2.5.0]
   at org.springframework.data.redis.connection.jedis.JedisConnection.doWithJedis(JedisConnection.java:799) ~[spring-data-redis-2.5.0.jar!/:2.5.0]
   ... 17 more

現在我想看看redis中有多少組,令我驚訝的是,在閱讀xgroup文件後我找不到任何命令來執行此操作。是否可以列出 redis 6.0+ 中的所有組?

XINFO GROUPS命令返回為給定流註冊的所有組的數組。自 5.0 中引入流以來,它一直可用。

對於每個組,它還提供了目前組消費者的數量、已讀取但尚未確認的條目數,以及該組的任何消費者看到的最新 ID。

引用自:https://dba.stackexchange.com/questions/297770