joeferner / redis-commander

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

Issues connecting to sentinel or redis when protected by password #433

Closed remus-corneliu closed 3 years ago

remus-corneliu commented 3 years ago

I have this simple docker-compose file.

services:
  redis-dev-master: 
    build:
      context: .
      dockerfile: ./redis.master.dockerfile
    image: redis:master
    container_name: redis-dev-master
    networks:
      htss-local:
        ipv4_address: 192.168.0.7
    ports:
      - 10020:6379
    volumes:
      - redis-master-volume:/data
    restart: unless-stopped    
    command: "redis-server /config/redis.conf"

  redis-dev-slave-1: 
   build:
     context: .
     dockerfile: ./redis.slave.dockerfile
   image: redis:slave
   container_name: redis-dev-slave-1
   depends_on:
     - redis-dev-master
   networks:
     htss-local:
       ipv4_address: 192.168.0.8
   ports:
     - 10021:6379
   volumes:
     - redis-slave1-volume:/data
   restart: unless-stopped  
   command: "redis-server /config/redis.conf"

  redis-dev-slave-2: 
    build:
      context: .
      dockerfile: ./redis.slave.dockerfile
    image: redis:slave
    container_name: redis-dev-slave-2
    depends_on:
      - redis-dev-master
    networks:
      htss-local:
        ipv4_address: 192.168.0.9
    ports:
      - 10022:6379
    volumes:
      - redis-slave2-volume:/data
    restart: unless-stopped   
    command: "redis-server /config/redis.conf"

  redis-dev-sentinel-1: 
    build:
      context: .
      dockerfile: ./redis.sentinel.dockerfile
    image: redis:sentinel
    container_name: redis-dev-sentinel-1
    networks:
      htss-local:
        ipv4_address: 192.168.0.10
    ports:
      - 10023:26379
    depends_on:
      - redis-dev-master
      - redis-dev-slave-1
      - redis-dev-slave-2
    volumes:
      - redis-sentinel1-volume:/data
    restart: unless-stopped    
    command: "redis-sentinel /config/redis.conf"

  redis-dev-sentinel-2: 
    build:
      context: .
      dockerfile: ./redis.sentinel.dockerfile
    image: redis:sentinel
    container_name: redis-dev-sentinel-2
    networks:
      htss-local:
        ipv4_address: 192.168.0.11
    ports:
      - 10024:26379
    depends_on:
      - redis-dev-master
      - redis-dev-slave-1
      - redis-dev-slave-2
    volumes:
      - redis-sentinel2-volume:/data
    restart: unless-stopped    
    command: "redis-sentinel /config/redis.conf"

  redis-dev-sentinel-3: 
    build:
      context: .
      dockerfile: ./redis.sentinel.dockerfile
    image: redis:sentinel
    container_name: redis-dev-sentinel-3
    networks:
      htss-local:
        ipv4_address: 192.168.0.12
    ports:
      - 10025:26379
    depends_on:
      - redis-dev-master
      - redis-dev-slave-1
      - redis-dev-slave-2
    volumes:
      - redis-sentinel3-volume:/data
    restart: unless-stopped    
    command: "redis-sentinel /config/redis.conf"

  redis-dev-ui:
    image: rediscommander/redis-commander:latest
    container_name: redis-dev-ui
    networks:
      htss-local:
        ipv4_address: 192.168.0.13
    ports:
    - 10026:8081
    depends_on:
      - redis-dev-master
    environment:
    - REDIS_HOSTS=local:redis-dev-master:6379
    - SENTINELS='redis-dev-sentinel-3:26379:redismaster,redis-dev-sentinel-2:26379:redismaster,redis-dev-sentinel-1:26379:redismaster'
    # - REDIS_PASSWORD=pass
    restart: unless-stopped    

Running this will result in this.

setUpConnection (S:redis-dev-sentinel-3:26379:mymaster-0) Redis error Error: All sentinels are unreachable. Retrying from scratch after 250ms. Last error: ERR No such master with that name redis-dev-ui at /redis-commander/node_modules/ioredis/built/connectors/SentinelConnector/index.js:55:3

Also, if I'm setting up a password for the redis, is going to complain about it and not be able to conenct to the redis server.

I've tried overriding the command section "redis-commander --redis-password ...." it complains about not knowing what redis-commander is

Am I doing something wrong ? the base image for the redis is redis:6.0-alpine

sseide commented 3 years ago

1.) the new user/password authentication added at Redis 6 is not supported, only the "old" requirepass config param is supported. When using the old auth type it should work.

2.) what is password protected? Redis-Server? Sentinel? Booth or one of them? Passwords need to be set accourdingly

3.) As the error message states it has connected to the sentinels but asked the sentinels to get a redis server connection for the sentinel-group "redis-dev-ui" which is not known to the sentinels. The default value for the master-group-name config value is mymaster. must be set with SENTINEL_NAME when configured different (sentinel server config param sentinel monitor ...`. Dont know where this snetinel-group name comes from - but not from this config snippet provided.

4.) you tried to configure two different redis connections at redis commander - if you only want to have one connection either set REDIS_HOSTS or SENTINELS. The redis servers itself must not be configured using sentinels - everything needed is queried from the sentinels itself (please read the redis docs about how sentinels work for that). The SENTINELS env var only contains commma separated list of host:port values, nothing else as you set.

sseide commented 3 years ago

Problem solved or not? Can issue be closed?

sseide commented 3 years ago

close as there is no feedback, probably solved