heroku node.js rediscloud redis::cannotconnecterror on localhost而不是rediscloud\u url

nx7onnlm  于 2021-06-09  发布在  Redis
关注(0)|答案(0)|浏览(262)

当我尝试将nodsjs应用程序连接到heroku上的rediscloud时,出现了以下错误

Redis::CannotConnectError: Error connecting to Redis on 127.0.0.1:6379 (ECONNREFUSED)

我甚至尝试在代码中直接设置redis的url和端口来测试它。但是,它仍然尝试连接到heroku上的localhost,而不是rediscloudurl。

const {Queue} = require('bullmq');
const Redis = require('ioredis');

const conn = new Redis(
      'redis://rediscloud:mueSEJFadzE9eVcjFei44444RIkNO@redis-15725.c9.us-east-1-4.ec2.cloud.redislabs.com:15725'

// Redis Server Connection Configuration
console.log('\n==================================================\n');
console.log(conn.options, process.env.REDISCLOUD_URL);

const defaultQueue = () => {
    // Initialize queue instance, by passing the queue-name & redis connection
    const queue = new Queue('default', {conn});
    return queue;
};
module.exports = defaultQueue;

完全倾倒原木https://pastebin.com/n9awjyl9

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题