【发布时间】:2017-07-13 16:02:48
【问题描述】:
从数字海洋指南安装 redis 后,我在 npm 上使用 redis 包,我使用他们帖子的 one 保护它。我将 requirepass 设置为密码,然后登录到我的 redis-cli 并成功验证了自己。但是我无法从我的 Node.js 应用程序中执行相同的操作。
这是我在 Node 中的配置
client = redis.createClient({
no_ready_check: true,
host : 'ip address',
port : port
});
client.auth('secretPassword', function(err, doc){
if(err)
throw err;
else if(doc === "OK"){
console.log("Authenticated");
}
});
client.on('error' , function (err) {
console.log("Error");
});
在我运行它之后。我收到此错误
events.js:160
throw er; // Unhandled 'error' event
^
ReplyError: Ready check failed: NOAUTH Authentication required.
at parseError (/home/ubuntu/demo/vehico-workers/node_modules/redis-parser/lib/parser.js:181:12)
at parseType (/home/ubuntu/demo/vehico-workers/node_modules/redis-parser/lib/parser.js:291:14)
根据我的最佳猜测,node-redis 驱动程序没有正确实现它,因为我能够从 cli 但不能从 Node 应用程序进行身份验证。有人在 AWS EC2 上成功运行了安全的 redis.conf 吗?
【问题讨论】: