Couldn't connect to redis instance
KYV365 opened this issue · 6 comments
Describe the problem
redis three master,three slave
192.168.0.1 7001 master
192.168.0.1 7002 slave
192.168.0.2 7001 master
192.168.0.2 7002 slave
192.168.0.3 7001 master
192.168.0.3 7002 slave
./redis_exporter -redis.addr 192.168.0.1 7001 -redis.password xxx -web.listen-address :9121
report error:
INFO[0000] Redis Metrics Exporter v1.40.0 build date: 2022-06-10-00:53:59 sha1: 3a74303 Go: go1.18.3 GOOS: linux GOARCH: amd64
INFO[0000] Providing metrics at :9121/metrics
ERRO[0000] Couldn't connect to redis instance (redis://192.168.0.1 7001)
ERRO[0001] Couldn't connect to redis instance (redis://192.168.0.1 7002)
ERRO[0002] Couldn't connect to redis instance (redis://192.168.0.2 7001)
ERRO[0004] Couldn't connect to redis instance (redis://192.168.0.2 7002)
ERRO[0005] Couldn't connect to redis instance (redis://192.169.6.9:7003)
ERRO[0006] Couldn't connect to redis instance (redis://192.168.0.3 7001)
ERRO[0007] Couldn't connect to redis instance (redis://192.168.0.3 7002)
What version of redis_exporter are you running?
Please run redis_exporter --version
if you're not sure what version you're running.
redis_exporter-v1.40.0
Redis Version: 6.0.9
redis_exporter-v1.40.0.linux-amd64.tar
prometheus-2.41.0.linux-amd64.tar
redis_version:5.0.7
redis_exporter-v1.48.0.linux-amd64
I have some issues just like raojun0504
In a redis cluster built on 5 instances and each instance runs master and slave on different ports and the whole cluster has credential authentication.
172.16.1.21 7000 master
172.16.1.21 7002 slave
172.16.1.22 7000 master
172.16.1.22 7001 slave
172.16.1.23 7000 master
172.16.1.23 7001 slave
172.16.1.24 7000 master
172.16.1.24 7001 slave
172.16.1.25 7000 master
172.16.1.25 7001 slave
Create a redis_exporter.conf file and it contains master & slave IP and PORT + PASSWORD
redis_addr: "redis://<PASSWORD>@IP:7000"
redis_alias: "master"
redis_slave_addr: "redis://<PASSWORD>@IP:7001"
redis_slave_alias: "slave"
namespace: "redis"
When running the below command there would be errors appear:
redis_exporter -config-command redis_exporter.conf
INFO[0000] Redis Metrics Exporter v1.48.0 build date: 2023-03-03-03:23:47 sha1: 30fba62cc31d80ccb8653ac33965e17c15929a24 Go: go1.20.1 GOOS: linux GOARCH: amd64
INFO[0000] Providing metrics at :9121/metrics
ERRO[0001] Couldn't connect to redis instance (redis://localhost:6379)
ERRO[0002] Couldn't connect to redis instance (redis://localhost:6379)
There is no redis service running on redis://localhost:6379 and when I pass the config file to redis_exporter it does not work probably.
Any suggestion?
redis_version:5.0.7 redis_exporter-v1.48.0.linux-amd64 I have some issues just like raojun0504 In a redis cluster built on 5 instances and each instance runs master and slave on different ports and the whole cluster has credential authentication.
172.16.1.21 7000 master 172.16.1.21 7002 slave 172.16.1.22 7000 master 172.16.1.22 7001 slave 172.16.1.23 7000 master 172.16.1.23 7001 slave 172.16.1.24 7000 master 172.16.1.24 7001 slave 172.16.1.25 7000 master 172.16.1.25 7001 slave
Create a redis_exporter.conf file and it contains master & slave IP and PORT + PASSWORD
redis_addr: "redis://<PASSWORD>@IP:7000" redis_alias: "master" redis_slave_addr: "redis://<PASSWORD>@IP:7001" redis_slave_alias: "slave" namespace: "redis"When running the below command there would be errors appear:
redis_exporter -config-command redis_exporter.conf INFO[0000] Redis Metrics Exporter v1.48.0 build date: 2023-03-03-03:23:47 sha1: 30fba62cc31d80ccb8653ac33965e17c15929a24 Go: go1.20.1 GOOS: linux GOARCH: amd64 INFO[0000] Providing metrics at :9121/metrics ERRO[0001] Couldn't connect to redis instance (redis://localhost:6379) ERRO[0002] Couldn't connect to redis instance (redis://localhost:6379)There is no redis service running on redis://localhost:6379 and when I pass the config file to redis_exporter it does not work probably. Any suggestion?
scrape_configs:
The job name is added as a label job=<job_name>
to any timeseries scraped from this config.
- job_name: 'redis_cluster'
static_configs:- targets:
- redis://127.0.0.1:7001
- redis://127.0.0.1:7002
- redis://127.0.0.1:7003
- redis://127.0.0.1:7004
- redis://127.0.0.1:7005
- redis://127.0.0.1:7006
metrics_path: /scrape
relabel_configs:
- source_labels: [address]
target_label: __param_target - source_labels: [__param_target]
target_label: instance - target_label: address
replacement: 127.0.0.1:9121
- targets:
- job_name: "redis_exporter"
metrics_path defaults to '/metrics'
scheme defaults to 'http'.
static_configs:- targets:
- 127.0.0.1:9121
- 127.0.0.1:9122
- 127.0.0.1:9123
- 127.0.0.1:9124
- 127.0.0.1:9125
- 127.0.0.1:9126
the six redis_exporter need to be started for redis_cluster,one to one。it is not seem to support redis_cluster smoothly。maybe the grafana and redis-datasource is suitable。
- targets:
redis_version:5.0.7 redis_exporter-v1.48.0.linux-amd64 I have some issues just like raojun0504 In a redis cluster built on 5 instances and each instance runs master and slave on different ports and the whole cluster has credential authentication.
172.16.1.21 7000 master 172.16.1.21 7002 slave 172.16.1.22 7000 master 172.16.1.22 7001 slave 172.16.1.23 7000 master 172.16.1.23 7001 slave 172.16.1.24 7000 master 172.16.1.24 7001 slave 172.16.1.25 7000 master 172.16.1.25 7001 slave
Create a redis_exporter.conf file and it contains master & slave IP and PORT + PASSWORD
redis_addr: "redis://<PASSWORD>@IP:7000" redis_alias: "master" redis_slave_addr: "redis://<PASSWORD>@IP:7001" redis_slave_alias: "slave" namespace: "redis"When running the below command there would be errors appear:
redis_exporter -config-command redis_exporter.conf INFO[0000] Redis Metrics Exporter v1.48.0 build date: 2023-03-03-03:23:47 sha1: 30fba62cc31d80ccb8653ac33965e17c15929a24 Go: go1.20.1 GOOS: linux GOARCH: amd64 INFO[0000] Providing metrics at :9121/metrics ERRO[0001] Couldn't connect to redis instance (redis://localhost:6379) ERRO[0002] Couldn't connect to redis instance (redis://localhost:6379)There is no redis service running on redis://localhost:6379 and when I pass the config file to redis_exporter it does not work probably. Any suggestion?
scrape_configs:
The job name is added as a label job=<job_name>
to any timeseries scraped from this config.
- job_name: 'redis_cluster'
static_configs:- targets:
- redis://127.0.0.1:7001
- redis://127.0.0.1:7002
- redis://127.0.0.1:7003
- redis://127.0.0.1:7004
- redis://127.0.0.1:7005
- redis://127.0.0.1:7006
metrics_path: /scrape
relabel_configs:
- source_labels: [address]
target_label: __param_target - source_labels: [__param_target]
target_label: instance - target_label: address
replacement: 127.0.0.1:9121
- targets:
- job_name: "redis_exporter"
metrics_path defaults to '/metrics'
scheme defaults to 'http'.
static_configs:- targets:
- 127.0.0.1:9121
- 127.0.0.1:9122
- 127.0.0.1:9123
- 127.0.0.1:9124
- 127.0.0.1:9125
- 127.0.0.1:9126
the six redis_exporter need to be started for redis_cluster,one to one。it is not seem to support redis_cluster smoothly。maybe the grafana and redis-datasource is suitable。
- targets:
redis_version:5.0.7 redis_exporter-v1.48.0.linux-amd64 I have some issues just like raojun0504 In a redis cluster built on 5 instances and each instance runs master and slave on different ports and the whole cluster has credential authentication.
172.16.1.21 7000 master 172.16.1.21 7002 slave 172.16.1.22 7000 master 172.16.1.22 7001 slave 172.16.1.23 7000 master 172.16.1.23 7001 slave 172.16.1.24 7000 master 172.16.1.24 7001 slave 172.16.1.25 7000 master 172.16.1.25 7001 slave
Create a redis_exporter.conf file and it contains master & slave IP and PORT + PASSWORD
redis_addr: "redis://<PASSWORD>@IP:7000" redis_alias: "master" redis_slave_addr: "redis://<PASSWORD>@IP:7001" redis_slave_alias: "slave" namespace: "redis"When running the below command there would be errors appear:
redis_exporter -config-command redis_exporter.conf INFO[0000] Redis Metrics Exporter v1.48.0 build date: 2023-03-03-03:23:47 sha1: 30fba62cc31d80ccb8653ac33965e17c15929a24 Go: go1.20.1 GOOS: linux GOARCH: amd64 INFO[0000] Providing metrics at :9121/metrics ERRO[0001] Couldn't connect to redis instance (redis://localhost:6379) ERRO[0002] Couldn't connect to redis instance (redis://localhost:6379)There is no redis service running on redis://localhost:6379 and when I pass the config file to redis_exporter it does not work probably. Any suggestion?
redis_version:5.0.7 redis_exporter-v1.48.0.linux-amd64 I have some issues just like raojun0504 In a redis cluster built on 5 instances and each instance runs master and slave on different ports and the whole cluster has credential authentication.
172.16.1.21 7000 master 172.16.1.21 7002 slave 172.16.1.22 7000 master 172.16.1.22 7001 slave 172.16.1.23 7000 master 172.16.1.23 7001 slave 172.16.1.24 7000 master 172.16.1.24 7001 slave 172.16.1.25 7000 master 172.16.1.25 7001 slave
Create a redis_exporter.conf file and it contains master & slave IP and PORT + PASSWORD
redis_addr: "redis://<PASSWORD>@IP:7000" redis_alias: "master" redis_slave_addr: "redis://<PASSWORD>@IP:7001" redis_slave_alias: "slave" namespace: "redis"When running the below command there would be errors appear:
redis_exporter -config-command redis_exporter.conf INFO[0000] Redis Metrics Exporter v1.48.0 build date: 2023-03-03-03:23:47 sha1: 30fba62cc31d80ccb8653ac33965e17c15929a24 Go: go1.20.1 GOOS: linux GOARCH: amd64 INFO[0000] Providing metrics at :9121/metrics ERRO[0001] Couldn't connect to redis instance (redis://localhost:6379) ERRO[0002] Couldn't connect to redis instance (redis://localhost:6379)There is no redis service running on redis://localhost:6379 and when I pass the config file to redis_exporter it does not work probably. Any suggestion?
scrape_configs:
The job name is added as a label job=<job_name>
to any timeseries scraped from this config.
- job_name: 'redis_cluster'
static_configs:- targets:
- redis://127.0.0.1:7001
- redis://127.0.0.1:7002
- redis://127.0.0.1:7003
- redis://127.0.0.1:7004
- redis://127.0.0.1:7005
- redis://127.0.0.1:7006
metrics_path: /scrape
relabel_configs:
- source_labels: [address]
target_label: __param_target - source_labels: [__param_target]
target_label: instance - target_label: address
replacement: 127.0.0.1:9121
- targets:
- job_name: "redis_exporter"
metrics_path defaults to '/metrics'
scheme defaults to 'http'.
static_configs:- targets:
- 127.0.0.1:9121
- 127.0.0.1:9122
- 127.0.0.1:9123
- 127.0.0.1:9124
- 127.0.0.1:9125
- 127.0.0.1:9126
the six redis_exporter need to be started for redis_cluster,one to one。it is not seem to support redis_cluster smoothly。maybe the grafana and redis-datasource is suitable。
- targets:
I had the same issue and as far as I get it right, this error messages comes from the redis exporter itself.
I've adapted my docker compose file with the following line.
command: ["--redis.addr=<string: one_of_my_host_or_ip>:<int: the_port>"] # This line prevents the logging entry `time="2023-03-17T10:09:20Z" level=error msg="Couldn't connect to redis instance (redis://localhost:6379)"` ref: https://github.com/oliver006/redis_exporter#prometheus-configuration-to-scrape-multiple-redis-hosts
It is a bit odd, that you have to choose one redis server that should never go down to prevent this error log message. If there is a better solution, let me know.
Cheers,
Stev
Edit
@raojun0504 feel free to close this issue if my answer solves your problem (neither you like it or not ;-))
It's in the README: https://github.com/oliver006/redis_exporter#prometheus-configuration-to-scrape-multiple-redis-hosts
Run the exporter with the command line flag --redis.addr= so it won't try to access the local instance every time the /metrics endpoint is scraped