node.js - 如何在 node.js 中使用 redis 进行身份验证?

标签 node.js authentication redis node-redis

我正在使用 node_redis 模块,但无法成功确定 redis 的密码。

这是我的代码:

var redis = require("redis"),
    client = redis.createClient(6379, "localhost"); 

client.auth("password", function (err) { if (err) throw err; }); 

每当我在命令行中运行此文件时,我都会收到以下消息:“Redis 不需要密码,但提供了密码。”

即使我尝试更改计算机的 redis 安装中的 redis.conf 文件,我仍然会遇到同样的错误:

requirepass password

请阐明这个问题。

最佳答案

当你启动redis服务器时使用这个命令: redis服务器/path/to/redis.conf

这样它将使用在 redis.conf 中指定的密码验证连接

关于node.js - 如何在 node.js 中使用 redis 进行身份验证?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29465081/

相关文章:

WCF session 或每次调用传递用户名/密码?

redis - 如何配置redis sentinel日志文件位置

Redis - 更新集成员

javascript - 调用nodejs的多个函数

javascript - 在 Node.js 中编写格式化的 JSON

node.js readFile 竞争条件 - 在未完全写入磁盘时读取文件

authentication - 无需登录的 Vimeo API AuthorizationUrl

c# - 如何以编程方式为单个应用程序设置多个身份验证 cookie

http - 如何在一天内存储服务器上的请求数?

javascript - PUT 请求中的错误(Angular 4 w/NodeJs API REST)