I have looked at this question: How to start redis-server on a different port than the default port 6379 in ubuntu
I'm trying to do just that via ioredis
in my NestJS
project, but it refuses to connect to any other port than 6379. I'm not running any separate Redis Server, I leave that to ioredis
. It's just that I want to run a separate instance for Testing purposes that does not run on port 6379.
The following code runs without error:
const redis = new Redis();
const redis = new Redis('localhost');
const redis = new Redis(6379);
And I can do everything I need to with this.
This code, however:
const redis = new Redis(6380);
const redis = new Redis(6380, 'localhost');
gives me the following error:
[ioredis] Unhandled error event: Error: connect ECONNREFUSED 127.0.0.1:6380
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
Do I have to use different ioredis
instantiation options? Or is it maybe something with NestJS? Because I am aware that NestJS has a page on Redis: https://docs.nestjs.com/microservices/redis , but they also specify port 6379. How come I cannot seem to get the basic example in the ioredis
API documentation working?