oliver006 / redis_exporter

Prometheus Exporter for ValKey & Redis Metrics. Supports ValKey and Redis 2.x, 3.x, 4.x, 5.x, 6.x, and 7.x
https://github.com/oliver006/redis_exporter
MIT License
3.03k stars 859 forks source link

redis 6 cluster :err: dial redis: unknown network redis #832

Closed fsckzy closed 8 months ago

fsckzy commented 9 months ago

operating system:Kylin-Server-V10-SP3-General-Release-2212-x86_64-2022-12-02 15:44:18 redis_exporter version: # ./redis_exporter --version INFO[0000] Redis Metrics Exporter v1.52.0 build date: 2023-07-26-02:18:15 sha1: 1b2258 1411521955cfa5b2332ba42a8650662073 Go: go1.20.6 GOOS: linux GOARCH: amd64

prometheus.yml:

 - job_name: 'redis_exporter_targets'
    static_configs:
      - targets:
        - redis://192.168.11.21:7001
        - redis://192.168.11.22:7001
        - redis://192.168.11.23:7001
        - redis://192.168.11.24:7001
        - redis://192.168.11.25:7001
        - redis://192.168.11.26:7001
    metrics_path: /scrape
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 192.168.11.21:9121
  ## config for scraping the exporter itself
  - job_name: 'redis_exporter'
    static_configs:
      - targets:
        - 192.168.11.21:9121

Start command:

nohup ./redis_exporter -redis.addr 192.168.11.22:7001 -redis.password "V8$ND1Wqq7z%kNsk" &

or

nohup ./redis_exporter -redis.addr 192.168.11.22:7001 -redis.password 'V8$ND1Wqq7z%kNsk' &

or

nohup ./redis_exporter -redis.addr 192.168.11.22:7001 -redis.password V8$ND1Wqq7z%kNsk &

I've tried single quotes, double quotes, without quotes. same result

debug log

time="2023-09-15T14:59:30+08:00" level=debug msg="streams: []exporter.dbKeyPair(nil)"
time="2023-09-15T14:59:30+08:00" level=debug msg="parseKeyArg(): Got empty key arguments, pa
rsing skipped"
time="2023-09-15T14:59:30+08:00" level=debug msg="singleStreams: []exporter.dbKeyPair(nil)"
time="2023-09-15T14:59:30+08:00" level=debug msg="parseKeyArg(): Got empty key arguments, pa
rsing skipped"
time="2023-09-15T14:59:30+08:00" level=debug msg="countKeys: []exporter.dbKeyPair(nil)"
time="2023-09-15T14:59:30+08:00" level=debug msg="Trying DialURL(): redis://192.168.11.24:70
01"
time="2023-09-15T14:59:30+08:00" level=debug msg="DialURL() failed, err: WRONGPASS invalid u
sername-password pair or user is disabled."
time="2023-09-15T14:59:30+08:00" level=debug msg="Trying: Dial(): redis 192.168.11.24:7001"
time="2023-09-15T14:59:30+08:00" level=error msg="Couldn't connect to redis instance (redis:
//192.168.11.24:7001)"
time="2023-09-15T14:59:30+08:00" level=debug msg="connectToRedis( redis://192.168.11.24:7001
 ) err: dial redis: unknown network redis"
time="2023-09-15T14:59:30+08:00" level=debug msg="scrapeRedisHost() done"

Redis cluster status:

[root@middleware1 redis_exporter]# /root/redis-6.2.13/src/redis-cli -h 192.168.11.21 -p 7001
192.168.11.21:7001> auth V8$ND1Wqq7z%kNsk
OK
192.168.11.21:7001> cluster nodes
760fbbbda48a748fb21c7e31c835f073e89fa247 192.168.11.26:7001@17001 slave 011bdedb2110c6c101e9
baedc74e856daa6e71ec 0 1694761239000 2 connected
69f32e9fe797188f3cc38f3f31643ec499ac9198 192.168.11.24:7001@17001 slave 530a47851712540fa21b
94ff7378f27da4aa5a10 0 1694761240410 3 connected
ed51110133aec7b6faad9f8d2ddb6641d1d25b8f 192.168.11.21:7001@17001 myself,master - 0 16947612
39000 1 connected 0-5460
73b485119bb9e1470a23ecf3f436c8e9de79bf11 192.168.11.25:7001@17001 slave ed51110133aec7b6faad
9f8d2ddb6641d1d25b8f 0 1694761241412 1 connected
530a47851712540fa21b94ff7378f27da4aa5a10 192.168.11.23:7001@17001 master - 0 1694761237000 3
 connected 10923-16383
011bdedb2110c6c101e9baedc74e856daa6e71ec 192.168.11.22:7001@17001 master - 0 1694761238404 2
 connected 5461-10922
192.168.11.21:7001> 

I'm sure the Redis cluster is normal and the password is correct. Is it because the password contains special characters?

fsckzy commented 9 months ago

Attached log file: log.zip

fsckzy commented 9 months ago

Who can help?

daicheng123 commented 7 months ago

dial redis: unknown network redis, "I have encountered the same error, and it looks like an issue with the https://github.com/gomodule/redigo package."