简体   繁体   中英

How to do authentication with redis in node.js?

I'm using the node_redis module and I'm not being able to determine a password for redis succesfully.

Here's my code:

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

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

Whenever I run this file in the command line I get the following message: "Redis does not require a password, but a password was supplied."

I keep getting the same error, even though I tried to change the redis.conf file that is in my computer's redis instalation:

requirepass password

Please, shed some light on the issue.

When you start the redis server use this command: redis-server /path/to/redis.conf

this way it will authenticate connections using password specified in redis.conf

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM