Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClusterAllFailedError: Failed to refresh slots cache #1103

Open
david1025 opened this issue Apr 15, 2020 · 2 comments
Open

ClusterAllFailedError: Failed to refresh slots cache #1103

david1025 opened this issue Apr 15, 2020 · 2 comments

Comments

@david1025
Copy link

this code run error : ClusterAllFailedError: Failed to refresh slots cache

const clusterOptions = {
    enableReadyCheck: false,
    clusterRetryStrategy: null
}
const redis = new Redis.Cluster([{ port: config.port, host: config.host }], clusterOptions)
@borodinalive
Copy link

borodinalive commented Apr 23, 2020

Yepp! I have the same problem. new Redis('address1:port') works fine, Redis.Cluster - not
For some reason dns.lookup does not find the address. Even if it's the only in array

if it can help

ioredis:cluster Got error Error: getaddrinfo ENOTFOUND redis://redis.long.address
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:64:26) {
errno: 'ENOTFOUND',
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'redis://redis.long.address'
}

@jamesarosen
Copy link

jamesarosen commented Jan 14, 2021

I'm having the same problem. We're using Redis 6.0.5.

const url = 'redis://default:[email protected]:14567'

// this works:
new Redis(url)

// this doesn't:
new Redis.Cluster([ url ])

// nor does this:
new Redis.Cluster([{ host: 'some.redis.host', port: 14567, password: 'mypassword' }])

Here's the DEBUG=ioredis:* log:

2021-01-14T19:46:03.621Z ioredis:redis status[some.redis.host:14567]: [empty] -> connecting
2021-01-14T19:46:03.625Z ioredis:cluster status: [empty] -> connecting
2021-01-14T19:46:03.826Z ioredis:cluster:connectionPool Reset with [
  {
    options: {
      enableReadyCheck: true,
      host: 'some.redis.host',
      password: 'mypassword',
      port: 14567,
      family: 4,
      connectTimeout: 10000,
      retryStrategy: [Function: retryStrategy],
      keepAlive: 0,
      noDelay: true,
      connectionName: null,
      sentinels: null,
      name: null,
      role: 'master',
      sentinelRetryStrategy: [Function: sentinelRetryStrategy],
      natMap: null,
      enableTLSForSentinelMode: false,
      updateSentinels: true,
      username: null,
      db: 0,
      dropBufferSupport: false,
      enableOfflineQueue: true,
      autoResubscribe: true,
      autoResendUnfulfilledCommands: true,
      lazyConnect: false,
      keyPrefix: '',
      reconnectOnError: null,
      readOnly: false,
      stringNumbers: false,
      maxRetriesPerRequest: 20,
      maxLoadingRetryTime: 10000,
      showFriendlyErrorStack: false
    },
    _events: [Object: null prototype] {},
    _eventsCount: 0,
    _maxListeners: undefined,
    scriptsSet: {},
    commandQueue: Denque { _head: 0, _tail: 0, _capacityMask: 3, _list: [Array] },
    offlineQueue: Denque { _head: 0, _tail: 0, _capacityMask: 3, _list: [Array] },
    connectionEpoch: 1,
    connector: StandaloneConnector {
      connecting: true,
      options: [Object],
      stream: [Socket]
    },
    retryAttempts: 0,
    status: 'connecting',
    condition: {
      select: 0,
      auth: 'mypassword',
      subscriber: false
    },
    port: 6379,
    host: '127.0.0.1',
    [Symbol(kCapture)]: false
  }
]
2021-01-14T19:46:03.826Z ioredis:cluster:connectionPool Connecting to 127.0.0.1:6379 as master
2021-01-14T19:46:03.826Z ioredis:redis status[127.0.0.1:6379]: [empty] -> wait
2021-01-14T19:46:03.827Z ioredis:cluster getting slot cache from 127.0.0.1:6379
2021-01-14T19:46:03.827Z ioredis:redis status[127.0.0.1:6379 (ioredisClusterRefresher)]: [empty] -> wait
2021-01-14T19:46:03.828Z ioredis:redis status[127.0.0.1:6379 (ioredisClusterRefresher)]: wait -> connecting
2021-01-14T19:46:03.829Z ioredis:redis queue command[127.0.0.1:6379 (ioredisClusterRefresher)]: 0 -> cluster([ 'slots' ])
2021-01-14T19:46:03.829Z ioredis:cluster:subscriber selected a subscriber 127.0.0.1:6379
2021-01-14T19:46:03.829Z ioredis:redis status[127.0.0.1:6379 (ioredisClusterSubscriber)]: [empty] -> wait
2021-01-14T19:46:03.829Z ioredis:cluster:subscriber started
2021-01-14T19:46:03.833Z ioredis:redis status[127.0.0.1:6379 (ioredisClusterRefresher)]: connecting -> connect
2021-01-14T19:46:03.833Z ioredis:redis status[127.0.0.1:6379 (ioredisClusterRefresher)]: connect -> ready
2021-01-14T19:46:03.833Z ioredis:connection set the connection name [ioredisClusterRefresher]
2021-01-14T19:46:03.833Z ioredis:redis write command[127.0.0.1:6379 (ioredisClusterRefresher)]: 0 -> client([ 'setname', 'ioredis
ClusterRefresher' ])
2021-01-14T19:46:03.834Z ioredis:connection send 1 commands in offline queue
2021-01-14T19:46:03.834Z ioredis:redis write command[127.0.0.1:6379 (ioredisClusterRefresher)]: 0 -> cluster([ 'slots' ])
[ioredis] Unhandled error event: ClusterAllFailedError: Failed to refresh slots cache.
    at tryNode (/Users/jamesarosen/code/apollo/node_modules/ioredis/built/cluster/index.js:359:31)
    at /Users/jamesarosen/code/apollo/node_modules/ioredis/built/cluster/index.js:376:21
    at /Users/jamesarosen/code/apollo/node_modules/ioredis/built/cluster/index.js:624:24
    at run (/Users/jamesarosen/code/apollo/node_modules/ioredis/built/utils/index.js:156:22)
    at tryCatcher (/Users/jamesarosen/code/apollo/node_modules/standard-as-callback/built/utils.js:11:23)
    at /Users/jamesarosen/code/apollo/node_modules/standard-as-callback/built/index.js:30:51

That 127.0.0.1:6379 looks suspicious to me. I don't have a Redis instance running there since the DB I'm connecting to is remote.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants