Skip to content

Commit

Permalink
docs: bull incompatibility with aliyun redis proxy mode (#3666)
Browse files Browse the repository at this point in the history
* Document about Aliyun Redis proxy mode incompatibility in  bull.md

<OptimalBits/bull#2606 (comment)>

* Update bull.md

* Update bull.md
  • Loading branch information
cyjake authored Feb 27, 2024
1 parent 8182a76 commit b661d1b
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion site/docs/extensions/bull.md
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ export default {

## 常见问题

### 1、EVALSHA错误
### 1、EVALSHA 错误

![image.png](https://img.alicdn.com/imgextra/i4/O1CN01KfjCKT1yypmNPDkIL_!!6000000006648-2-tps-3540-102.png)

Expand All @@ -814,3 +814,23 @@ export default {

解决办法是 task 里的 prefix 配置用 {} 包括,强制 redis 只计算 {} 里的hash,例如 `prefix: '{midway-task}'`

### 2、EVAL inside MULTI is not allowed 错误

```
ReplyError: EXECABORT Transaction discarded because of previous errors.
at parseError (<project_dir>/node_modules/redis-parser/lib/parser.js:179:12)
at parseType (<project_dir>/node_modules/redis-parser/lib/parser.js:302:14) {
command: { name: 'exec', args: [] },
previousErrors: [
ReplyError: ERR 'EVAL' inside MULTI is not allowed
at parseError (<project_dir>/node_modules/redis-parser/lib/parser.js:179:12)
at parseType (<project_dir>/node_modules/redis-parser/lib/parser.js:302:14) {
command: [Object]
}
]
}
```

问题表现为 queue.createBulk()、job.moveToFailed() 等任务队列 API 调用无效,这些 API 依赖的 Redis Lua 脚本中使用了 EVAL 或者 EVALSHA。报错的原因是阿里云 Redis 使用代理模式连接时,会对 Lua 脚本调用做额外限制,包括不允许在 MULTI 事务中执行 EVAL 命令(<https://help.aliyun.com/zh/redis/support/usage-of-lua-scripts?#section-8f7-qgv-dlv>),文档中还提到可以通过参数配置 script_check_enable 关闭这一校验,但是验证无效。

好在切换到直连模式可以解决这个问题,可以在阿里云控制台操作开启直连地址,由于直连模式需要客户端切换成集群模式,需要参考前文中的「Redis 集群」章节,切换成 defaultQueueOptions.createClient 配置方式。

0 comments on commit b661d1b

Please sign in to comment.