question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Connecting to an Azure Redis Cluster with TLS not working

See original GitHub issue

I’ve been trying to connect to a Redis three node cluster in Azure using ioredis

When I connect using the Redis.Cluster constructor:

new Redis.Cluster(['host.redis.cache.windows.net', 6380], {
    scaleReads: 'all',
    slotsRefreshTimeout: 2000,
    redisOptions: {
        password: 'some-secret',
        tls: true as any
    },
});

The error I get is:

2020-06-04T13:05:41.787Z ioredis:cluster getting slot cache from 127.0.0.1:6380
2020-06-04T13:05:41.788Z ioredis:redis status[127.0.0.1:6380 (ioredisClusterRefresher)]: [empty] -> wait
2020-06-04T13:05:41.788Z ioredis:redis status[127.0.0.1:6380 (ioredisClusterRefresher)]: wait -> connecting
2020-06-04T13:05:41.788Z ioredis:redis queue command[127.0.0.1:6380 (ioredisClusterRefresher)]: 0 -> cluster([ 'slots' ])
2020-06-04T13:05:41.790Z ioredis:connection error: Error: connect ECONNREFUSED 127.0.0.1:6380
2020-06-04T13:05:41.791Z ioredis:redis status[127.0.0.1:6380 (ioredisClusterRefresher)]: connecting -> close
2020-06-04T13:05:41.791Z ioredis:connection skip reconnecting because `retryStrategy` is not a function
2020-06-04T13:05:41.791Z ioredis:redis status[127.0.0.1:6380 (ioredisClusterRefresher)]: close -> end
2020-06-04T13:05:41.792Z [auth-middleware] Redis error { ClusterAllFailedError: Failed to refresh slots cache.
    at tryNode (/app/node_modules/ioredis/built/cluster/index.js:359:31)
    at /app/node_modules/ioredis/built/cluster/index.js:376:21
    at duplicatedConnection.cluster.utils_2.timeout (/app/node_modules/ioredis/built/cluster/index.js:624:24)
    at run (/app/node_modules/ioredis/built/utils/index.js:156:22)
    at tryCatcher (/app/node_modules/standard-as-callback/built/utils.js:11:23)
    at promise.then (/app/node_modules/standard-as-callback/built/index.js:30:51)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  lastNodeError:
   Error: Connection is closed.
       at close (/app/node_modules/ioredis/built/redis/event_handler.js:179:25)
       at TLSSocket.<anonymous> (/app/node_modules/ioredis/built/redis/event_handler.js:150:20)
       at Object.onceWrapper (events.js:277:13)
       at TLSSocket.emit (events.js:194:15)
       at _handle.close (net.js:600:12)
       at TCP.done (_tls_wrap.js:388:7) }

When I connect using a non-cluster Redis connection:

new Redis(6380, 'host.redis.cache.windows.net', { password: 'some-secret' });

The error I get is:

020-06-04T15:04:08.609Z ioredis:redis status[10.211.x.x:6380]: connecting -> connect
2020-06-04T15:04:08.614Z ioredis:redis write command[10.211.x.x:6380]: 0 -> auth([ 'some-secret' ])
2020-06-04T15:04:08.616Z ioredis:redis write command[10.211.x.x:6380]: 0 -> info([])
2020-06-04T15:05:16.114Z ioredis:connection error: Error: read ECONNRESET
2020-06-04T15:05:16.115Z [auth-middleware] Redis error { Error: read ECONNRESET
    at TCP.onStreamRead (internal/stream_base_commons.js:111:27) errno: 'ECONNRESET', code: 'ECONNRESET', syscall: 'read' }

As you can see it is using TLS on port 6380. Azure provides me with one host+port combination and two different access-keys (primary/seconday) - which I find weird, which access-key should I use? Also I’m not sure if I should be connecting in Cluster mode, but I’d prefer to to gain the benefits of clustering. When I do it appears it tries to find the slots at 127.0.0.1:6380 which is probably not correct.

In Azure’s quickstart they connect using node_redis with:

var redis = require("redis");

// Add your cache name and access key.
var client = redis.createClient(6380, process.env.REDISCACHEHOSTNAME,
    {auth_pass: process.env.REDISCACHEKEY, tls: {servername: process.env.REDISCACHEHOSTNAME}});

I was hoping someone here would have come across the same issue and solved it.

Thanks!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:11

github_iconTop GitHub Comments

7reactions
sin-kocommented, Aug 17, 2020

I ran into a similar issue, that it is telling me there are too many redirect. It happening to me when i try to connect to an ElastiCache instance. Finally this config look stable enough

const cluster = new Redis.Cluster([
    {
        port: 6379,
        host: `hostname from aws console`
    }],
    {
        redisOptions: {
            password: 'password',
            tls: { servername: `hostname from aws console` },
        }
    })

hope this help

1reaction
filidorwiesecommented, Sep 23, 2020

Let me clarify the issues we face with ioredis in combination with Azure Redis Cluster when TLS is enabled.

Using this script:

import Redis from "ioredis";

function createRedisClient() {
  const { host, port, password } = {
    host: "hostname-provided-by-azure",
    port: 6380,
    password: "secret-provided-by-azure"
  };

  console.log(`Connecting to Redis cluster on ${ host }:${ port }...`);

  const redisClient = new Redis.Cluster([host, port], {
    scaleReads: "all",
    slotsRefreshTimeout: 2000,
    redisOptions: {
      password,
      tls: { servername: host }
    }
  });

  redisClient.on("error", (err: any) => { console.log(`Redis error`, err); });
  redisClient.on("reconnecting", () => console.log(`Redis reconnecting...`));

  return redisClient;
}

createRedisClient();

When run with DEBUG=ioredis.*, the code results in a reconnecting loop:

Connecting to Redis cluster on hostname-provided-by-azure:6380...
  ioredis:cluster status: [empty] -> connecting +0ms
  ioredis:cluster resolved hostname hostname-provided-by-azure to IP 10.x.x.148 +3s
  ioredis:cluster:connectionPool Reset with [
  ioredis:cluster:connectionPool   { host: '10.x.x.148', port: 6379 },
  ioredis:cluster:connectionPool   { port: 6380, host: '127.0.0.1' }
  ioredis:cluster:connectionPool ] +0ms
  ioredis:cluster:connectionPool Connecting to 10.x.x.148:6379 as master +3ms
  ioredis:redis status[10.x.x.148:6379]: [empty] -> wait +0ms
  ioredis:cluster:connectionPool Connecting to 127.0.0.1:6380 as master +1ms
  ioredis:redis status[127.0.0.1:6380]: [empty] -> wait +0ms
  ioredis:cluster getting slot cache from 127.0.0.1:6380 +6ms
  ioredis:redis status[127.0.0.1:6380 (ioredisClusterRefresher)]: [empty] -> wait +2ms
  ioredis:redis status[127.0.0.1:6380 (ioredisClusterRefresher)]: wait -> connecting +1ms
  ioredis:redis queue command[127.0.0.1:6380 (ioredisClusterRefresher)]: 0 -> cluster([ 'slots' ]) +1ms
  ioredis:cluster:subscriber selected a subscriber 10.x.x.148:6379 +0ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterSubscriber)]: [empty] -> wait +1ms
  ioredis:cluster:subscriber started +0ms
  ioredis:connection error: Error: connect ECONNREFUSED 127.0.0.1:6380
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) {
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 6380
} +0ms
  ioredis:redis status[127.0.0.1:6380 (ioredisClusterRefresher)]: connecting -> close +8ms
  ioredis:connection skip reconnecting because `retryStrategy` is not a function +3ms
  ioredis:redis status[127.0.0.1:6380 (ioredisClusterRefresher)]: close -> end +1ms
  ioredis:cluster getting slot cache from 10.x.x.148:6379 +14ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterRefresher)]: [empty] -> wait +1ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterRefresher)]: wait -> connecting +1ms
  ioredis:redis queue command[10.x.x.148:6379 (ioredisClusterRefresher)]: 0 -> cluster([ 'slots' ]) +0ms
Redis error ClusterAllFailedError: Failed to refresh slots cache.
    at tryNode (/app/node_modules/ioredis/built/cluster/index.js:359:31)
    at /app/node_modules/ioredis/built/cluster/index.js:376:21
    at Timeout.<anonymous> (/app/node_modules/ioredis/built/cluster/index.js:624:24)
    at Timeout.run (/app/node_modules/ioredis/built/utils/index.js:156:22)
    at listOnTimeout (internal/timers.js:551:17)
    at processTimers (internal/timers.js:492:7) {
  lastNodeError: Error: timeout
      at Object.timeout (/app/node_modules/ioredis/built/utils/index.js:159:38)
      at Cluster.getInfoFromNode (/app/node_modules/ioredis/built/cluster/index.js:621:55)
      at tryNode (/app/node_modules/ioredis/built/cluster/index.js:365:19)
      at /app/node_modules/ioredis/built/cluster/index.js:376:21
      at /app/node_modules/ioredis/built/cluster/index.js:624:24
      at run (/app/node_modules/ioredis/built/utils/index.js:156:22)
      at tryCatcher (/app/node_modules/standard-as-callback/built/utils.js:11:23)
      at /app/node_modules/standard-as-callback/built/index.js:30:51
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
}
  ioredis:cluster:connectionPool Reset with [] +2s
  ioredis:cluster:connectionPool Disconnect 10.x.x.148:6379 because the node does not hold any slot +1ms
  ioredis:redis status[10.x.x.148:6379]: wait -> close +2s
  ioredis:connection skip reconnecting since the connection is manually closed. +2s
  ioredis:redis status[10.x.x.148:6379]: close -> end +0ms
  ioredis:cluster:connectionPool Remove 10.x.x.148:6379 from the pool +0ms
  ioredis:cluster:connectionPool Disconnect 127.0.0.1:6380 because the node does not hold any slot +0ms
  ioredis:redis status[127.0.0.1:6380]: wait -> close +0ms
  ioredis:connection skip reconnecting since the connection is manually closed. +0ms
  ioredis:redis status[127.0.0.1:6380]: close -> end +0ms
  ioredis:cluster:connectionPool Remove 127.0.0.1:6380 from the pool +0ms
  ioredis:cluster:subscriber subscriber has left, selecting a new one... +2s
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterSubscriber)]: wait -> close +1ms
  ioredis:connection skip reconnecting since the connection is manually closed. +1ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterSubscriber)]: close -> end +0ms
  ioredis:cluster:subscriber selecting subscriber failed since there is no node discovered in the cluster yet +0ms
  ioredis:cluster status: connecting -> close +2s
  ioredis:cluster status: close -> close +0ms
  ioredis:cluster status: close -> reconnecting +1ms
Redis reconnecting...
  ioredis:cluster connecting failed: Error: None of startup nodes is available
    at Cluster.closeListener (/app/node_modules/ioredis/built/cluster/index.js:171:28)
    at Object.onceWrapper (events.js:421:28)
    at Cluster.emit (events.js:327:22)
    at Cluster.EventEmitter.emit (domain.js:483:12)
    at /app/node_modules/ioredis/built/cluster/index.js:330:18
    at processTicksAndRejections (internal/process/task_queues.js:79:11) +0ms
  ioredis:cluster Cluster is disconnected. Retrying after 102ms +102ms
  ioredis:cluster status: reconnecting -> connecting +0ms
  ioredis:cluster resolved hostname hostname-provided-by-azure to IP 10.x.x.148 +147ms
  ioredis:cluster:connectionPool Reset with [
  ioredis:cluster:connectionPool   { host: '10.x.x.148', port: 6379 },
  ioredis:cluster:connectionPool   { port: 6380, host: '127.0.0.1' }
  ioredis:cluster:connectionPool ] +251ms
  ioredis:cluster:connectionPool Connecting to 10.x.x.148:6379 as master +1ms
  ioredis:redis status[10.x.x.148:6379]: [empty] -> wait +251ms
  ioredis:cluster:subscriber a new node is discovered and there is no subscriber, selecting a new one... +251ms
  ioredis:cluster:subscriber selected a subscriber 10.x.x.148:6379 +0ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterSubscriber)]: [empty] -> wait +0ms
  ioredis:cluster:connectionPool Connecting to 127.0.0.1:6380 as master +0ms
  ioredis:redis status[127.0.0.1:6380]: [empty] -> wait +0ms
  ioredis:cluster getting slot cache from 10.x.x.148:6379 +1ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterRefresher)]: [empty] -> wait +1ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterRefresher)]: wait -> connecting +0ms
  ioredis:redis queue command[10.x.x.148:6379 (ioredisClusterRefresher)]: 0 -> cluster([ 'slots' ]) +0ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterSubscriber)]: wait -> close +0ms
  ioredis:connection skip reconnecting since the connection is manually closed. +252ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterSubscriber)]: close -> end +0ms
  ioredis:cluster:subscriber selected a subscriber 127.0.0.1:6380 +1ms
  ioredis:redis status[127.0.0.1:6380 (ioredisClusterSubscriber)]: [empty] -> wait +0ms
  ioredis:cluster:subscriber started +1ms
  ioredis:cluster getting slot cache from 127.0.0.1:6380 +2s
  ioredis:redis status[127.0.0.1:6380 (ioredisClusterRefresher)]: [empty] -> wait +2s
  ioredis:redis status[127.0.0.1:6380 (ioredisClusterRefresher)]: wait -> connecting +0ms
  ioredis:redis queue command[127.0.0.1:6380 (ioredisClusterRefresher)]: 0 -> cluster([ 'slots' ]) +0ms
  ioredis:connection error: Error: connect ECONNREFUSED 127.0.0.1:6380
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) {
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 6380
} +2s
  ioredis:redis status[127.0.0.1:6380 (ioredisClusterRefresher)]: connecting -> close +2ms
  ioredis:connection skip reconnecting because `retryStrategy` is not a function +0ms
  ioredis:redis status[127.0.0.1:6380 (ioredisClusterRefresher)]: close -> end +0ms
Redis error ClusterAllFailedError: Failed to refresh slots cache.
    at tryNode (/app/node_modules/ioredis/built/cluster/index.js:359:31)
    at /app/node_modules/ioredis/built/cluster/index.js:376:21
    at /app/node_modules/ioredis/built/cluster/index.js:624:24
    at run (/app/node_modules/ioredis/built/utils/index.js:156:22)
    at tryCatcher (/app/node_modules/standard-as-callback/built/utils.js:11:23)
    at /app/node_modules/standard-as-callback/built/index.js:30:51
    at processTicksAndRejections (internal/process/task_queues.js:97:5) {
  lastNodeError: Error: Connection is closed.
      at close (/app/node_modules/ioredis/built/redis/event_handler.js:179:25)
      at TLSSocket.<anonymous> (/app/node_modules/ioredis/built/redis/event_handler.js:150:20)
      at Object.onceWrapper (events.js:422:26)
      at TLSSocket.emit (events.js:327:22)
      at TLSSocket.EventEmitter.emit (domain.js:483:12)
      at net.js:674:12
      at TCP.done (_tls_wrap.js:567:7)
}
  ioredis:cluster:connectionPool Reset with [] +2s
  ioredis:cluster:connectionPool Disconnect 10.x.x.148:6379 because the node does not hold any slot +0ms
  ioredis:redis status[10.x.x.148:6379]: wait -> close +2ms
  ioredis:connection skip reconnecting since the connection is manually closed. +2ms
  ioredis:redis status[10.x.x.148:6379]: close -> end +0ms
  ioredis:cluster:connectionPool Remove 10.x.x.148:6379 from the pool +1ms
  ioredis:cluster:connectionPool Disconnect 127.0.0.1:6380 because the node does not hold any slot +0ms
  ioredis:redis status[127.0.0.1:6380]: wait -> close +1ms
  ioredis:connection skip reconnecting since the connection is manually closed. +1ms
  ioredis:redis status[127.0.0.1:6380]: close -> end +0ms
  ioredis:cluster:connectionPool Remove 127.0.0.1:6380 from the pool +0ms
  ioredis:cluster status: connecting -> close +6ms
  ioredis:cluster:subscriber subscriber has left, selecting a new one... +2s
  ioredis:redis status[127.0.0.1:6380 (ioredisClusterSubscriber)]: wait -> close +0ms
  ioredis:connection skip reconnecting since the connection is manually closed. +0ms
  ioredis:redis status[127.0.0.1:6380 (ioredisClusterSubscriber)]: close -> end +0ms
  ioredis:cluster:subscriber selecting subscriber failed since there is no node discovered in the cluster yet +0ms
  ioredis:cluster status: close -> close +1ms
  ioredis:cluster status: close -> reconnecting +0ms
Redis reconnecting...
  ioredis:cluster Got error Error: None of startup nodes is available

... et cetera

If I run it without TLS on port 3679, I get a single reconnect and then a working stable connection:

Connecting to Redis cluster on hostname-provided-by-azure:6379...
  ioredis:cluster status: [empty] -> connecting +0ms
  ioredis:cluster resolved hostname hostname-provided-by-azure to IP 10.x.x.148 +3s
  ioredis:cluster:connectionPool Reset with [
  ioredis:cluster:connectionPool   { host: '10.x.x.148', port: 6379 },
  ioredis:cluster:connectionPool   { port: 6379, host: '127.0.0.1' }
  ioredis:cluster:connectionPool ] +0ms
  ioredis:cluster:connectionPool Connecting to 10.x.x.148:6379 as master +3ms
  ioredis:redis status[10.x.x.148:6379]: [empty] -> wait +0ms
  ioredis:cluster:connectionPool Connecting to 127.0.0.1:6379 as master +1ms
  ioredis:redis status[127.0.0.1:6379]: [empty] -> wait +1ms
  ioredis:cluster getting slot cache from 10.x.x.148:6379 +6ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterRefresher)]: [empty] -> wait +1ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterRefresher)]: wait -> connecting +1ms
  ioredis:redis queue command[10.x.x.148:6379 (ioredisClusterRefresher)]: 0 -> cluster([ 'slots' ]) +1ms
  ioredis:cluster:subscriber selected a subscriber 10.x.x.148:6379 +0ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterSubscriber)]: [empty] -> wait +1ms
  ioredis:cluster:subscriber started +1ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterRefresher)]: connecting -> connect +3ms
  ioredis:redis write command[10.x.x.148:6379 (ioredisClusterRefresher)]: 0 -> auth([ 'secret-provided-by-azure' ]) +0ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterRefresher)]: connect -> ready +1ms
  ioredis:connection set the connection name [ioredisClusterRefresher] +0ms
  ioredis:redis write command[10.x.x.148:6379 (ioredisClusterRefresher)]: 0 -> client([ 'setname', 'ioredisClusterRefresher' ]) +0ms
  ioredis:connection send 1 commands in offline queue +1ms
  ioredis:redis write command[10.x.x.148:6379 (ioredisClusterRefresher)]: 0 -> cluster([ 'slots' ]) +1ms
  ioredis:cluster getting slot cache from 127.0.0.1:6379 +2s
  ioredis:redis status[127.0.0.1:6379 (ioredisClusterRefresher)]: [empty] -> wait +2s
  ioredis:redis status[127.0.0.1:6379 (ioredisClusterRefresher)]: wait -> connecting +0ms
  ioredis:redis queue command[127.0.0.1:6379 (ioredisClusterRefresher)]: 0 -> cluster([ 'slots' ]) +0ms
  ioredis:connection error: Error: connect ECONNREFUSED 127.0.0.1:6379
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) {
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 6379
} +2s
  ioredis:redis status[127.0.0.1:6379 (ioredisClusterRefresher)]: connecting -> close +5ms
  ioredis:connection skip reconnecting because `retryStrategy` is not a function +3ms
  ioredis:redis status[127.0.0.1:6379 (ioredisClusterRefresher)]: close -> end +0ms
Redis error ClusterAllFailedError: Failed to refresh slots cache.
    at tryNode (/app/node_modules/ioredis/built/cluster/index.js:359:31)
    at /app/node_modules/ioredis/built/cluster/index.js:376:21
    at /app/node_modules/ioredis/built/cluster/index.js:624:24
    at run (/app/node_modules/ioredis/built/utils/index.js:156:22)
    at tryCatcher (/app/node_modules/standard-as-callback/built/utils.js:11:23)
    at /app/node_modules/standard-as-callback/built/index.js:30:51
    at processTicksAndRejections (internal/process/task_queues.js:97:5) {
  lastNodeError: Error: Connection is closed.
      at close (/app/node_modules/ioredis/built/redis/event_handler.js:179:25)
      at Socket.<anonymous> (/app/node_modules/ioredis/built/redis/event_handler.js:150:20)
      at Object.onceWrapper (events.js:422:26)
      at Socket.emit (events.js:315:20)
      at Socket.EventEmitter.emit (domain.js:483:12)
      at TCP.<anonymous> (net.js:674:12)
}
  ioredis:cluster:connectionPool Reset with [] +2s
  ioredis:cluster:connectionPool Disconnect 10.x.x.148:6379 because the node does not hold any slot +0ms
  ioredis:redis status[10.x.x.148:6379]: wait -> close +3ms
  ioredis:connection skip reconnecting since the connection is manually closed. +3ms
  ioredis:redis status[10.x.x.148:6379]: close -> end +0ms
  ioredis:cluster:connectionPool Remove 10.x.x.148:6379 from the pool +1ms
  ioredis:cluster:connectionPool Disconnect 127.0.0.1:6379 because the node does not hold any slot +0ms
  ioredis:redis status[127.0.0.1:6379]: wait -> close +1ms
  ioredis:connection skip reconnecting since the connection is manually closed. +1ms
  ioredis:redis status[127.0.0.1:6379]: close -> end +0ms
  ioredis:cluster:connectionPool Remove 127.0.0.1:6379 from the pool +0ms
  ioredis:cluster:subscriber subscriber has left, selecting a new one... +2s
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterSubscriber)]: wait -> close +0ms
  ioredis:connection skip reconnecting since the connection is manually closed. +0ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterSubscriber)]: close -> end +0ms
  ioredis:cluster:subscriber selecting subscriber failed since there is no node discovered in the cluster yet +0ms
  ioredis:cluster status: connecting -> close +9ms
  ioredis:cluster status: close -> close +1ms
  ioredis:cluster status: close -> reconnecting +0ms
Redis reconnecting...
  ioredis:cluster connecting failed: Error: None of startup nodes is available
    at Cluster.closeListener (/app/node_modules/ioredis/built/cluster/index.js:171:28)
    at Object.onceWrapper (events.js:421:28)
    at Cluster.emit (events.js:327:22)
    at Cluster.EventEmitter.emit (domain.js:483:12)
    at /app/node_modules/ioredis/built/cluster/index.js:330:18
    at processTicksAndRejections (internal/process/task_queues.js:79:11) +0ms
  ioredis:cluster Cluster is disconnected. Retrying after 102ms +102ms
  ioredis:cluster status: reconnecting -> connecting +0ms
  ioredis:cluster resolved hostname hostname-provided-by-azure to IP 10.x.x.148 +53ms
  ioredis:cluster:connectionPool Reset with [
  ioredis:cluster:connectionPool   { host: '10.x.x.148', port: 6379 },
  ioredis:cluster:connectionPool   { port: 6379, host: '127.0.0.1' }
  ioredis:cluster:connectionPool ] +156ms
  ioredis:cluster:connectionPool Connecting to 10.x.x.148:6379 as master +0ms
  ioredis:redis status[10.x.x.148:6379]: [empty] -> wait +156ms
  ioredis:cluster:subscriber a new node is discovered and there is no subscriber, selecting a new one... +157ms
  ioredis:cluster:subscriber selected a subscriber 10.x.x.148:6379 +0ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterSubscriber)]: [empty] -> wait +1ms
  ioredis:cluster:connectionPool Connecting to 127.0.0.1:6379 as master +1ms
  ioredis:redis status[127.0.0.1:6379]: [empty] -> wait +0ms
  ioredis:cluster getting slot cache from 127.0.0.1:6379 +1ms
  ioredis:redis status[127.0.0.1:6379 (ioredisClusterRefresher)]: [empty] -> wait +1ms
  ioredis:redis status[127.0.0.1:6379 (ioredisClusterRefresher)]: wait -> connecting +0ms
  ioredis:redis queue command[127.0.0.1:6379 (ioredisClusterRefresher)]: 0 -> cluster([ 'slots' ]) +0ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterSubscriber)]: wait -> close +0ms
  ioredis:connection skip reconnecting since the connection is manually closed. +158ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterSubscriber)]: close -> end +0ms
  ioredis:cluster:subscriber selected a subscriber 10.x.x.148:6379 +1ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterSubscriber)]: [empty] -> wait +1ms
  ioredis:cluster:subscriber started +1ms
  ioredis:connection error: Error: connect ECONNREFUSED 127.0.0.1:6379
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) {
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 6379
} +1ms
  ioredis:redis status[127.0.0.1:6379 (ioredisClusterRefresher)]: connecting -> close +1ms
  ioredis:connection skip reconnecting because `retryStrategy` is not a function +1ms
  ioredis:redis status[127.0.0.1:6379 (ioredisClusterRefresher)]: close -> end +0ms
  ioredis:cluster getting slot cache from 10.x.x.148:6379 +3ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterRefresher)]: [empty] -> wait +0ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterRefresher)]: wait -> connecting +0ms
  ioredis:redis queue command[10.x.x.148:6379 (ioredisClusterRefresher)]: 0 -> cluster([ 'slots' ]) +0ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterRefresher)]: connecting -> connect +2ms
  ioredis:redis write command[10.x.x.148:6379 (ioredisClusterRefresher)]: 0 -> auth([ 'secret-provided-by-azure' ]) +0ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterRefresher)]: connect -> ready +0ms
  ioredis:connection set the connection name [ioredisClusterRefresher] +2ms
  ioredis:redis write command[10.x.x.148:6379 (ioredisClusterRefresher)]: 0 -> client([ 'setname', 'ioredisClusterRefresher' ]) +0ms
  ioredis:connection send 1 commands in offline queue +1ms
  ioredis:redis write command[10.x.x.148:6379 (ioredisClusterRefresher)]: 0 -> cluster([ 'slots' ]) +1ms
  ioredis:cluster cluster slots result count: 4 +5ms
  ioredis:cluster cluster slots result [0]: slots 0~5461 served by [ '10.x.x.148:13001' ] +0ms
  ioredis:cluster cluster slots result [1]: slots 8192~13652 served by [ '10.x.x.148:13003', '10.x.x.148:13002' ] +1ms
  ioredis:cluster cluster slots result [2]: slots 5462~8191 served by [ '10.x.x.148:13005', '10.x.x.148:13004' ] +1ms
  ioredis:cluster cluster slots result [3]: slots 13653~16383 served by [ '10.x.x.148:13005', '10.x.x.148:13004' ] +1ms
  ioredis:cluster:connectionPool Reset with [
  ioredis:cluster:connectionPool   { host: '10.x.x.148', port: 13001, readOnly: false },
  ioredis:cluster:connectionPool   { host: '10.x.x.148', port: 13003, readOnly: false },
  ioredis:cluster:connectionPool   { host: '10.x.x.148', port: 13002, readOnly: true },
  ioredis:cluster:connectionPool   { host: '10.x.x.148', port: 13005, readOnly: false },
  ioredis:cluster:connectionPool   { host: '10.x.x.148', port: 13004, readOnly: true },
  ioredis:cluster:connectionPool   { host: '10.x.x.148', port: 13005, readOnly: false },
  ioredis:cluster:connectionPool   { host: '10.x.x.148', port: 13004, readOnly: true }
  ioredis:cluster:connectionPool ] +11ms
  ioredis:cluster:connectionPool Disconnect 10.x.x.148:6379 because the node does not hold any slot +1ms
  ioredis:redis status[10.x.x.148:6379]: wait -> close +6ms
  ioredis:connection skip reconnecting since the connection is manually closed. +6ms
  ioredis:redis status[10.x.x.148:6379]: close -> end +0ms
  ioredis:cluster:connectionPool Remove 10.x.x.148:6379 from the pool +0ms
  ioredis:cluster:connectionPool Disconnect 127.0.0.1:6379 because the node does not hold any slot +0ms
  ioredis:redis status[127.0.0.1:6379]: wait -> close +0ms
  ioredis:connection skip reconnecting since the connection is manually closed. +0ms
  ioredis:redis status[127.0.0.1:6379]: close -> end +0ms
  ioredis:cluster:connectionPool Remove 127.0.0.1:6379 from the pool +0ms
  ioredis:cluster:connectionPool Connecting to 10.x.x.148:13001 as master +0ms
  ioredis:redis status[10.x.x.148:13001]: [empty] -> wait +1ms
  ioredis:cluster:connectionPool Connecting to 10.x.x.148:13003 as master +1ms
  ioredis:redis status[10.x.x.148:13003]: [empty] -> wait +0ms
  ioredis:cluster:connectionPool Connecting to 10.x.x.148:13002 as slave +0ms
  ioredis:redis status[10.x.x.148:13002]: [empty] -> wait +0ms
  ioredis:cluster:connectionPool Connecting to 10.x.x.148:13005 as master +0ms
  ioredis:redis status[10.x.x.148:13005]: [empty] -> wait +0ms
  ioredis:cluster:connectionPool Connecting to 10.x.x.148:13004 as slave +0ms
  ioredis:redis status[10.x.x.148:13004]: [empty] -> wait +0ms
  ioredis:cluster status: connecting -> connect +3ms
  ioredis:redis status[10.x.x.148:13003]: wait -> connecting +2ms
  ioredis:redis queue command[10.x.x.148:13003]: 0 -> cluster([ 'info' ]) +0ms
  ioredis:cluster:subscriber subscriber has left, selecting a new one... +13ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterSubscriber)]: wait -> close +0ms
  ioredis:connection skip reconnecting since the connection is manually closed. +3ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterSubscriber)]: close -> end +1ms
  ioredis:cluster:subscriber selected a subscriber 10.x.x.148:13003 +2ms
  ioredis:redis status[10.x.x.148:13003 (ioredisClusterSubscriber)]: [empty] -> wait +1ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterRefresher)]: ready -> close +1ms
  ioredis:connection skip reconnecting since the connection is manually closed. +3ms
  ioredis:redis status[10.x.x.148:6379 (ioredisClusterRefresher)]: close -> end +0ms
  ioredis:redis status[10.x.x.148:13003]: connecting -> connect +1ms
  ioredis:redis write command[10.x.x.148:13003]: 0 -> auth([ 'secret-provided-by-azure' ]) +0ms
  ioredis:redis write command[10.x.x.148:13003]: 0 -> info([]) +0ms
  ioredis:redis status[10.x.x.148:13003]: connect -> ready +1ms
  ioredis:connection send 1 commands in offline queue +2ms
  ioredis:redis write command[10.x.x.148:13003]: 0 -> cluster([ 'info' ]) +0ms
  ioredis:cluster status: connect -> ready +7ms

I’m not sure what to make of it. It could very well be something custom in the way Azure configures the Redis cluster in the background, a bug in ioredis, or perhaps a misconfiguration on our end. Either way, we’re pretty much blocked by this issue.

Any help would be appreciated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Connecting to an Azure Redis Cluster using node.js ioredis ...
Okay I've managed to connect to Azure Redis Cluster using a non-tls connection: new Redis.Cluster(['host.redis.cache.windows.net', 3679], ...
Read more >
Troubleshoot connectivity in Azure Cache for Redis
Learn how to resolve connectivity problems when creating clients with Azure Cache for Redis.
Read more >
How to configure Azure Cache for Redis | Microsoft Learn
Redis version 4 or 6. In the Advanced tab for premium cache instance, configure the settings for non-TLS port, clustering, and data persistence....
Read more >
Configure Redis clustering - Premium Azure Cache for Redis
Learn how to create and manage Redis clustering for your Premium tier Azure Cache for Redis instances.
Read more >
Use redis-cli with Azure Cache for Redis - Microsoft Learn
Enable the non-TLS port (6379 ) - This configuration is not recommended because in this configuration, the access keys are sent via TCP...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found