node.js - 无法连接到托管的 redis : Ready check failed: ERR operation not permitted

标签 node.js redis

我正在尝试连接到 IrisCouch 上通过 Nodejitsu 配置的托管 redis。

认为是我的 server.js 的相关部分:

var redisUrl = require('url').parse(config.REDIS_CONNECTION_URI);
var client = require('redis').createClient(redisUrl.port, redisUrl.hostname);

我还没有在我的 server.js 中与客户端进行任何交互,这就是为什么我认为它抛出“不允许的操作”很奇怪,因为基本上我唯一的操作做的是连接。我没有 redis.conf 文件,我相信我不应该需要一个,因为我自己不托管 redis 实例。

日志:

 Express server listening on port 3000

/Users/soroushhakami/dev/projects/projectx/node_modules/redis/index.js:504
                throw callback_err;
                      ^
Error: Ready check failed: ERR operation not permitted
    at RedisClient.on_info_cmd (/Users/soroushhakami/dev/projects/projectx/node_modules/redis/index.js:317:35)
    at Command.RedisClient.ready_check.send_anyway [as callback] (/Users/soroushhakami/dev/projects/projectx/node_modules/redis/index.js:365:14)
    at RedisClient.return_error (/Users/soroushhakami/dev/projects/projectx/node_modules/redis/index.js:500:25)
    at ReplyParser.RedisClient.init_parser (/Users/soroushhakami/dev/projects/projectx/node_modules/redis/index.js:260:14)
    at ReplyParser.EventEmitter.emit (events.js:96:17)
    at ReplyParser.send_error (/Users/soroushhakami/dev/projects/projectx/node_modules/redis/lib/parser/javascript.js:293:10)
    at ReplyParser.execute (/Users/soroushhakami/dev/projects/projectx/node_modules/redis/lib/parser/javascript.js:176:22)
    at RedisClient.on_data (/Users/soroushhakami/dev/projects/projectx/node_modules/redis/index.js:476:27)
    at Socket.<anonymous> (/Users/soroushhakami/dev/projects/projectx/node_modules/redis/index.js:79:14)
    at Socket.EventEmitter.emit (events.js:96:17)

对可能出现的问题有什么想法吗?

最佳答案

创建客户端后需要直接调用client.auth():

var client = require('redis').createClient(redisUrl.port, redisUrl.hostname);
client.auth(PASSWORD);

令人困惑的是,当你不在 client 上调用 .auth() 但也没有别的时,你会得到一个失败的就绪检查错误。

关于node.js - 无法连接到托管的 redis : Ready check failed: ERR operation not permitted,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15848707/

相关文章:

node.js - 当第一个 Express 应用程序与路线不匹配时,回退到另一个 Express 应用程序

javascript - 使用 Q Node 模块时 Bluemix Node.js 应用程序部署失败

lua - 为什么lua在redis中这么慢?任何解决方法?

node.js - 避免 redis 竞争条件

javascript - 如何使用 Fuse.js 和 Redis 在 MySQL 表中进行全文搜索?

ruby - redis 键没有过期

ios - IOS 应用程序中未收到 Firebase 推送通知角标(Badge)计数

html - 如何在 nodejs 中通过 TCP/IP 获取传感器数据?

ajax - 向本地主机nodejs服务器发送简单的ajax请求

lua - Redis Capped Sorted Set、List 还是 Queue?