#redis 监控部署


#下载exporter


docker pull oliver006/redis_exporter

#查看redis的网络名称


[root@localhost docker]# docker inspect docker-cache-1 | grep NetworkMode
            "NetworkMode": "learn-dev-net",

#查看redis容器的ip


[root@localhost docker]# docker exec -it docker-cache-1 /bin/sh
/data # ip a
1: lo: mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
45361: eth0@if45362: mtu 1500 qdisc noqueue state UP 
    link/ether 02:42:ac:1e:00:03 brd ff:ff:ff:ff:ff:ff
    inet 172.30.0.3/16 brd 172.30.255.255 scope global eth0
       valid_lft forever preferred_lft forever

#执行命令


docker run -d --name redis_exporter_learn --network learn-dev-net -p 9123:9121 oliver006/redis_exporter --redis.addr redis://172.30.0.3:6379

#89机器 /root/monitor/docker/prometheus/prometheus.yml
  - job_name: redis_exporter
    scrape_interval: 150s
    scrape_timeout: 100s
    static_configs:
    - targets:
      - 192.168.0.90:9121
      
#浏览器打开,能采集到数据


http://192.168.0.88:9123/

你可能感兴趣的:(redis,数据库,缓存)