I'm trying to use Redis with Traefik but am running into some issues.
I followed this issue: https://github.com/containous/traefik/issues/4930 in how they configured Redis with docker compose, but when doing so and trying to PING the redis db, I get the following error:
Error: Protocol error, got "H" as reply type byte
After going through some forums and StackOverFlow, it seems like this issue may come up when instead of TCP, Traefik uses HTTP (although in the dashboard it does show up as TCP).
Here is my docker compose file:
version: "3"
networks:
proxy:
external: true
internal:
external: false
services:
hog:
image: traefik:v2.1.2
command:
- --entrypoints.web.address=:80
- --entrypoints.redis.address=:50000
- --providers.docker
- --api
- --ping=true
ports:
- "50000:50000"
- "80:80"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
- proxy
labels:
- "traefik.http.routers.api.rule=Host(`subdomain.domain.tld`)"
- "traefik.http.routers.api.service=api@internal"
- "traefik.http.routers.api.middlewares=auth"
- "traefik.http.middlewares.auth.basicauth.users=admin:password"
redis:
image: redis:5
labels:
- "traefik.tcp.routers.redis.entrypoints=redis"
- "traefik.tcp.routers.redis.rule=HostSNI(`another-subdomain.domain.tld`)"
- "traefik.tcp.services.redis.loadbalancer.server.port=50000"
- "traefik.tcp.routers.redis.tls=true"
command: ["redis-server", "/usr/local/etc/redis/redis.conf", "--appendonly", "yes", "--requirepass", "password"]
hostname: redis
volumes:
- ./redis-data:/data
- ./redis.conf:/usr/local/etc/redis/redis.conf
Even without a redis.conf and using the given conf, I get the same issue. Any help would be greatly appreciated.
To be clear, it seems like I'm able to connect to the DB since I get Redis' shell when I do redis-cli like the following:
redis-cli --no-auth-warning -h another-subdomain.domain.tld -p 50000 -a 'password'
But when I do PING within that shell I get that error aforementioned.