joeferner / redis-commander

Redis management tool written in node.js
http://joeferner.github.io/redis-commander/
MIT License
3.56k stars 460 forks source link

Redis error ClusterAllFailedError: Failed to refresh slots cache #527

Open gmussi opened 1 year ago

gmussi commented 1 year ago

I am facing an issue with the following docker-compose.yml:

  rediscmd:
    image: ghcr.io/joeferner/redis-commander:latest
    restart: unless-stopped
    environment:
      REDIS_HOST: REDACTED.memorydb.eu-central-1.amazonaws.com
      REDIS_PORT: 6379
      REDIS_TLS: true
      REDIS_USERNAME: REDACTED
      REDIS_PASSWORD: REDACTED

It used to work fine before, but after pulling the latest image I am getting:

setUpConnection (C:REDACTED.memorydb.eu-central-1.amazonaws.com:6379:0) Redis error ClusterAllFailedError: Failed to refresh slots cache.
    at tryNode (/redis-commander/node_modules/ioredis/built/cluster/index.js:308:31)
    at /redis-commander/node_modules/ioredis/built/cluster/index.js:325:21
    at Timeout.<anonymous> (/redis-commander/node_modules/ioredis/built/cluster/index.js:662:24)
    at Timeout.run (/redis-commander/node_modules/ioredis/built/utils/index.js:117:22)
    at listOnTimeout (node:internal/timers:571:11)
    at process.processTimers (node:internal/timers:512:7)

Without any changes in infrastructure or configuration.

EDIT: this problem is not present in the previous version (0.8.1)

sseide commented 1 year ago

with latest image RedisCluster support was added. After connection to the Redis server it checks its properties to figure out if we are dealing with a cluster setup -> if yes it reconnects with IORedis Cluster client now.

Its an AWS Memorydb or ElastiCache?

Older image used plain Redis client instead on every connection.

sseide commented 1 year ago

And is it possible to start Redis Commander with the DEBUG=ioredis:* env var set? Maybe the real error was hidden by the "ClusterAllFailedError".

sseide commented 1 year ago

@gmussi i was able to repoduce this error and pushed a fix to latest. Can you please test if it helps you too?

sseide commented 1 year ago

@gmussi added some more code to handle more variants. Any feedback if it is working for you now?

grantkl commented 1 year ago

Can you add CLUSTER_NO_TLS_VALIDATION as a supported ENV variable? I don't see it in https://github.com/joeferner/redis-commander/blob/master/docker/entrypoint.sh

grantkl commented 1 year ago

After manually configuring the json configuration to:

{
      "label": "local",
      "dbIndex": 0,
      "username": null,
      "password": "",
      "connectionName": "redis",
      "optional": false,
      "clusterNoTlsValidation": true,
      "host": "localhost",
      "port": 6379,
      "isCluster": true,
      "sentinelUsername": null,
      "sentinelPassword": "",
      "clusters": [
        {
          "host": "clustercfg.redis.nwuplk.usw2.cache.amazonaws.com",
          "port": 6379
        }
      ]
    }

I still get

node ./bin/redis-commander
Using scan instead of keys
No Save: false
listening on 0.0.0.0:8081
access with browser at http://127.0.0.1:8081
setUpConnection (C:clustercfg.redis.nwuplk.usw2.cache.amazonaws.com:6379:0) Redis error ClusterAllFailedError: Failed to refresh slots cache.
    at tryNode (/redis-commander/node_modules/ioredis/built/cluster/index.js:308:31)
    at /redis-commander/node_modules/ioredis/built/cluster/index.js:325:21
    at Timeout.<anonymous> (/redis-commander/node_modules/ioredis/built/cluster/index.js:662:24)
    at Timeout.run (/redis-commander/node_modules/ioredis/built/utils/index.js:117:22)
    at listOnTimeout (node:internal/timers:571:11)
    at process.processTimers (node:internal/timers:512:7)
aamotharald commented 6 months ago

Hi @grantkl , at least with running on node directly I was able to connect to a clustered redis instance in AWS and visualize it.

redis-commander  \
  --cluster-no-tls-validation\
  --is-cluster \
  --redis-tls \
  --redis-host <some-aws-cluster-host> \
  --redis-port <some-aws-cluster-port> \
  --redis-password <a-very-secret-password>

So I would expect that to also work in docker with having the CLUSTER_NO_TLS_VALIDATION for docker.