【发布时间】:2021-10-27 04:39:57
【问题描述】:
我正在尝试使用 CacheModule 连接到 NestJS 中的我的 redis 存储,我更新了我的存储以输入密码,但现在无法从 NestJS 连接(与 redis-cli 完美配合,并且在输入密码之前它可以在 nestJS 上运行)。
我试过这个:
import * as redisStore from 'cache-manager-redis-store'; // v2.0
@Module({
imports: [
CacheModule.register({
store: redisStore,
url: 'redis://:azerty@localhost:6379/0', // 'redis://h:azerty@localhost:6379/0' and 'redis://default:azerty@localhost:6379/0'
}),
],
controllers: [],
providers: [],
})
连接字符串在 redis-cli 中工作,但在 NestJS 中无效,它会抛出 ReplyError: WRONGPASS invalid username-password pair or user is disabled. 或 ReplyError: Ready check failed: NOAUTH Authentication required.(取决于连接字符串)
我也尝试了“正常”的方式:
CacheModule.register({
store: redisStore,
host: 'localhost',
port: 6379,
auth_pass: 'azerty', // also tried password: 'azerty'
}),
我得到了与连接字符串一相同的错误ReplyError: Ready check failed: NOAUTH Authentication required.。
我怎样才能让它工作?
【问题讨论】:
标签: redis nestjs node-redis