redis群集连接丢失

nwlqm0z1  于 2021-06-10  发布在  Redis
关注(0)|答案(0)|浏览(370)

我在kubernetes中部署了一个redis集群,它带有bitnami/redis集群图。我使用redis cluster npm包从nodejs连接到集群。连接完成后,我试着连续设置上千个键。完成所有的加工时间预计为十分钟。但连接两分钟后,redis的连接就断了。
是否是连接问题,我该怎么办?比如改变配置什么的。
在我的场景或常见场景中,连接丢失的确切原因是什么?
我的代码:

const redis = require('redis');
const redisCluster = require('redis-clustr')
const redisClient = new redisCluster({
    servers: [
    { host: "IP", port: 6379 },
    { host: "IP", port: 6379 }, 
    { host: "IP", port: 6379 },  
    { host: "IP", port: 6379 },
    { host: "IP", port: 6379 }, 
    { host: "IP", port: 6379 } 
     ],
    createClient: (port, host) => {
      return redis.createClient({ 
       port,
       host,
       auth_pass: 'PASSWORD',
     });
   }
});
 <My data processing code to set thousands of keys>
(node:15827) UnhandledPromiseRejectionWarning: AbortError: Redis connection lost and command aborted. It might have been processed.
    at RedisClient.flush_and_error (/root/data-pipeline/node_modules/redis/index.js:362:23)
    at RedisClient.connection_gone (/root/data-pipeline/node_modules/redis/index.js:664:14)
    at Socket.<anonymous> (/root/data-pipeline/node_modules/redis/index.js:293:14)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)
    at Socket.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
(node:15827) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:15827) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题