【问题标题】:How to do authentication with redis in node.js?如何在 node.js 中使用 redis 进行身份验证?
【发布时间】:2015-04-17 15:17:49
【问题描述】:

我正在使用 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

请说明一下这个问题。

【问题讨论】:

    标签: node.js authentication redis node-redis


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-10-21
      • 2017-03-24
      • 2016-11-20
      • 1970-01-01
      • 2016-10-21
      • 2023-04-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多