Node.js连接到Redis集群

问题描述 投票:0回答:1

有大量示例和资源可用于连接到Redis“服务器”,而不是连接到Redis“集群”。

我目前拥有的是:

const redis = require("redis"); 
const client = redis.createClient({
 port      : 6379,               // replace with your port
 host      : '10.0.0.100',        // replace with your hostanme or IP address
 password  : 'Notforyou',    // replace with your password
 // optional, if using SSL
 // use `fs.readFile[Sync]` or another method to bring these values in
 tls       : {
   key  : stringValueOfKeyFile,  
   cert : stringValueOfCertFile,
   ca   : [ stringValueOfCaCertFile ]
 }
});

但是这是针对单个Redis服务器而不是集群。我将如何连接到群集?

node.js redis redis-cluster
1个回答
0
投票

检出此库ioredis

我认为这将帮助您解决问题。

© www.soinside.com 2019 - 2024. All rights reserved.