我有一个 Parse Server(基本上是一个 Node.js 服务器),我正在尝试连接到一个 redis 数据库,该数据库托管在 DigitalOcean Managed Databases 上。两个服务器都在同一个 VPC 网络上,并且 droplet 已添加到 redis 接受的传入连接中。
这是我的解析服务器上的代码:
const redis = require("redis")
const redisClient = redis.createClient({
url: "rediss://username:[email protected]:25061"
})
连接字符串由 DigitalOcean 生成。Droplet 的出站流量规则已打开
这是我的错误日志:
2|index | AbortError: Ready check failed: Redis connection lost and command aborted. It might have been processed.
2|index | at RedisClient.flush_and_error (/root/parse-server-example/node_modules/redis/index.js:362:23)
2|index | at RedisClient.connection_gone (/root/parse-server-example/node_modules/redis/index.js:664:14)
2|index | at Socket.<anonymous> (/root/parse-server-example/node_modules/redis/index.js:293:14)
2|index | at Object.onceWrapper (events.js:313:30)
2|index | at emitNone (events.js:111:20)
2|index | at Socket.emit (events.js:208:7)
2|index | at endReadableNT (_stream_readable.js:1064:12)
2|index | at args.(anonymous function) (/usr/lib/node_modules/pm2/node_modules/event-loop-inspector/index.js:138:29)
2|index | at _combinedTickCallback (internal/process/next_tick.js:139:11)
2|index | at process._tickDomainCallback (internal/process/next_tick.js:219:9)
知道我做错了什么吗?
答案1
似乎 的最新版本redis
与 node 的版本不兼容。我降级redis
到3.0.4
并且运行良好!