Closed seekcx closed 5 years ago
Translation of this issue:
https://github.com/eggjs/egg-redis/blob/master/lib/redis.js#L19-L20 The first problem, this verification is too absolute, when the cluster is linked, the password is configured via redisOptions. Now I don't configure the password parameter plugin to report an error directly.
Exports.redis = {
Client: {
Cluster: true,
Nodes: [{
Host: '127.0.0.1',
Port: '6379',
}],
redisOptions: {
Password: 'secret',
}
},
};
https://github.com/eggjs/egg-redis/blob/master/lib/redis.js#L24 The second problem, here directly using the entire client configuration as the second parameter passed to Redis.Cluster, thrown
Failed to refresh slots cache. Error
[ioredis] Unhandled error event: Error: Failed to refresh slots cache.
At tryNode (/Users/abel/Desktop/work/smart-investment/node_modules/ioredis/lib/cluster/index.js:375:19)
At /Users/abel/Desktop/work/smart-investment/node_modules/ioredis/lib/cluster/index.js:387:9
At /Users/abel/Desktop/work/smart-investment/node_modules/ioredis/lib/cluster/index.js:591:14
At run (/Users/abel/Desktop/work/smart-investment/node_modules/ioredis/lib/utils/index.js:153:16)
At tryCatcher (/Users/abel/Desktop/work/smart-investment/node_modules/bluebird/js/release/util.js:16:23)
At Promise.errorAdapter [as _rejectionHandler0] (/Users/abel/Desktop/work/smart-investment/node_modules/bluebird/js/release/nodeify.js:35:34)
At Promise._settlePromise (/Users/abel/Desktop/work/smart-investment/node_modules/bluebird/js/release/promise.js:566:21)
At Promise._settlePromise0 (/Users/abel/Desktop/work/smart-investment/node_modules/bluebird/js/release/promise.js:614:10)
At Promise._settlePromises (/Users/abel/Desktop/work/smart-investment/node_modules/bluebird/js/release/promise.js:690:18)
At _drainQueueStep (/Users/abel/Desktop/work/smart-investment/node_modules/bluebird/js/release/async.js:138:12)
At _drainQueue (/Users/abel/Desktop/work/smart-investment/node_modules/bluebird/js/release/async.js:131:9)
At Async._drainQueues (/Users/abel/Desktop/work/smart-investment/node_modules/bluebird/js/release/async.js:147:5)
At Immediate.Async.drainQueues (/Users/abel/Desktop/work/smart-investment/node_modules/bluebird/js/release/async.js:17:14)
At runCallback (timers.js:810:20)
At tryOnImmediate (timers.js:768:5)
At processImmediate [as _immediateCallback] (timers.js:745:5)
Modify source fixed transmission
redisOptions: {
Password: 'secret',
}
There is no such problem after that.
Guess if there is a conflict with the parameter name? It is recommended to add a separate parameter to configure.
密码写错了。。打扰了。
https://github.com/eggjs/egg-redis/blob/master/lib/redis.js#L19-L20 第一个问题,这个验证过于绝对,集群链接时,密码是通过 redisOptions 配置的。现在不配置密码参数插件直接报错了。
https://github.com/eggjs/egg-redis/blob/master/lib/redis.js#L24 第二个问题,这里直接使用整个 client 的配置作为第二个参数传递给了 Redis.Cluster,抛出了
Failed to refresh slots cache. 错误
修改源码固定传递
之后没有此问题。
猜测是否是参数名发生了冲突? 建议增加一个单独的参数来配置。