Node.js 带有Nodejs的Redis TLS配置
我使用ioRedis节点包将我的node js应用程序连接到redis服务器,redis服务器由TLS保护。我使用的Redis版本是Redis6.0。我的服务器使用证书运行良好,但在从节点应用程序连接时出现错误Node.js 带有Nodejs的Redis TLS配置,node.js,ssl,redis,ioredis,Node.js,Ssl,Redis,Ioredis,我使用ioRedis节点包将我的node js应用程序连接到redis服务器,redis服务器由TLS保护。我使用的Redis版本是Redis6.0。我的服务器使用证书运行良好,但在从节点应用程序连接时出现错误 Redis({ host: "localhost", port: 6379, tls: { key: fs.readFileSync('./redis.key'), cert:
Redis({
host: "localhost",
port: 6379,
tls: {
key: fs.readFileSync('./redis.key'),
cert: fs.readFileSync('./redis.crt'),
maxVersion: 'TLSv1.3',
minVersion: 'TLSv1.3',
ca: [fs.readFileSync('./redis.pem')]
}
})
nodejs应用程序端的错误为
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(). The promise rejected with the reason:
Error: read ECONNRESET
at TCP.onStreamRead (internal/stream_base_commons.js:205:27)
尝试从nodejs应用程序连接时服务器出错
17:29:44.295#接受客户端连接时出错:错误:1408F10B:SSL例程:ssl3_get_记录:错误的版本号
我们的目标就是让redis与TLS安全性建立连接。我也在做同样的事情,我尝试了这种方法
const redis = require('redis');
const fs = require('fs');
const client = redis.createClient({
host: '<hostname>',
port: <port>,
tls: {}
});
constredis=require('redis');
常数fs=要求('fs');
const client=redis.createClient({
主机:“”,
端口:,
tls:{}
});
不要传递证书密钥,而是尝试将tls作为空对象传递。
该方法的指南如下所示。
我在GitHub问同样的问题:也许你也可以在那里发表评论。