BUSYGROUP Consumer Group name already exists: Consumer group already exists(消费者组已存在)
Redis含义
您试图用 XGROUP CREATE 在 stream 上创建消费者组,但该 stream 上已存在同名组。Redis 不会覆盖已有的组。
原因
应用在启动时无条件地尝试创建组,而该组是上次运行遗留下来的;或多个实例并行尝试创建同一个组。是非幂等启动逻辑的典型表现。
解决方法
使组的创建幂等:捕获并忽略该错误(组已存在没有问题)。使用 XGROUP CREATE stream group $ MKSTREAM,在 stream 尚不存在时自动创建它。运行 XINFO GROUPS stream 查看现有组。如果确实要重置,先用 XGROUP DESTROY stream group 删除它。
同一数据库的其他条目
- ERR unknown commandUnknown command(未知命令)
- TRYAGAIN Multiple keys request during rehashing of slotMultiple keys request during rehashing of slot (cluster)(槽重新哈希期间的多键请求)
- ERR DISCARD without MULTIDISCARD without MULTI(未执行 MULTI 就调用 DISCARD)
- NOGROUP No such key or consumer groupNo such key or consumer group in stream(stream 中不存在该键或消费者组)
- NOTBUSY No scripts in execution right nowNo scripts in execution right now(当前没有正在执行的脚本)
- DENIED Redis is running in protected modeRedis is running in protected mode(Redis 正以保护模式运行)
- ERR Can't execute '<cmd>': only (P|S)SUBSCRIBE / (P|S)UNSUBSCRIBE / PING / QUIT / RESET are allowed in this contextCommand not allowed in subscribe context(在订阅上下文中不允许该命令)