Help with redis config
Hi!
I'm about to configure traefik-kop, but I'm stuck with configure redis. I know this problem not related with the traefik-kop closely, but I hope you can help me out configure the dependencies of traefik-kop.
I got this error message in my traefik log:
ERR KV connection error, retrying in 12.842237106s error="KV store connection error: dial tcp 127.0.0.1:6379: connect: connection refused" providerName=redis
And I have this in my docker-compose.yaml
redis: image: redis:latest container_name: redis ports: - "6379:6379" volumes: - ./redis/dаta:/root/redis - ./redis/redis.conf:/usr/local/etc/redis/redis.conf environment: - REDIS_PORT=6379 - REDIS_DATABASES=16 restart: unless-stopped
And this is my traefik.yml:
providers: docker: endpoint: "unix:///var/run/docker.sock" exposedByDefault: false redis: endpoints: - "127.0.0.1:6379"
If I use "redis: 6379" I got this error:
ERR KV connection error, retrying in 7.257585599s error="KV store connection error: dial tcp: lookup redis on 127.0.0.11:53: no such host" providerName=redis
@bttd I see that redis is being run via docker-compose. How is traefik being run? Is it also via docker and in the same compose file? If so, you can add the following to traefik:
traefik:
links:
- redis
Then you can set the redis endpoint to redis:6379 and it should connect.
If traefik is running directly on the host, the exposed port should work. You can always check if you are able to access it via a simple curl test like curl -v 127.0.0.1:6379 to see if you can connect on that port.
If I use "redis: 6379" I got this error:
ERR KV connection error, retrying in 7.257585599s error="KV store connection error: dial tcp: lookup redis on 127.0.0.11:53: no such host" providerName=redis
I just set up Traefik-Kop and Redis for Traefik. I got the same error before I realised that I had forgotten to make sure that Traefik and Redis were on the same docker network.
In the Traefik-Kop documentation it states:
# assumes a redis link with this service name running on the same
# docker host as traefik
To use hostname, you'll want a custom docker bridge network for traefik and redis to connect via container_name:container_port
They can also be in the same compose file, which is how I run it