• docker-composer +Grafana+Prometheus系统监控之Redis


    1.创建docker网络

    • networks: redisnet

    1.创建3台redis

    • 镜像redis:latest
    • hostname redis-1 用于容器内部通讯
    • 端口使用默认的6379

    2.创建redis监控

    • 镜像oliver006/redis_exporter
    • hostname redis-1 用于容器内部通讯
    • 端口使用默认的9121
    • redis-1:6379 使用hostname

    3.创建prometheus用于收集数据

    • volumes 用于将本地配置映射到容器内部

    4.创建grafana展示数据

    5.完整代码

    version: '3'
    
    services:
      redis-1:
        image: redis:latest
        container_name: redis-1
        hostname: redis-1
    #    ports:
    #      - "6379:6379"
        restart: always
        networks:
          redisnet:
    
      redis-2:
        image: redis:latest
        container_name: redis-2
        hostname: redis-2
    #    ports:
    #      - "6380:6379"
        restart: always
        networks:
          redisnet:
    
      redis-3:
        image: redis:latest
        container_name: redis-3
        hostname: redis-3
    #    ports:
    #      - "6381:6379"
        restart: always
        networks:
          redisnet:
    
      redis-exporter-1:
        image: oliver006/redis_exporter
        container_name: redis_exporter_1
        hostname: redis_exporter_1
        restart: always
    #    ports:
    #      - "9121:9121"
        networks:
          - redisnet
        command:
          - '--redis.addr=redis://redis-1:6379'
    
      redis-exporter-2:
        image: oliver006/redis_exporter
        container_name: redis_exporter_2
        hostname: redis_exporter_2
        restart: always
        expose:
          - 9122
    #    ports:
    #      - "9122:9121"
        networks:
          - redisnet
        command:
          - '--redis.addr=redis://redis-2:6379'
    
      redis-exporter-3:
        image: oliver006/redis_exporter
        container_name: redis_exporter_3
        hostname: redis_exporter_3
        restart: always
    #    ports:
    #      - "9123:9121"
        networks:
          - redisnet
        command:
          - '--redis.addr=redis://redis-3:6379'
    
      prometheus:
        image: prom/prometheus:latest
        volumes:
          - ./prometheus.yml:/etc/prometheus/prometheus.yml
        ports:
          - '9090:9090'
        networks:
          - redisnet
        hostname: prometheus
        container_name: prometheus
    
      grafana:
        image: grafana/grafana:latest
        environment:
          - GF_SECURITY_ADMIN_PASSWORD=admin
        depends_on:
          - prometheus
        ports:
          - "3000:3000"
        networks:
          - redisnet
        hostname: grafana
        container_name: grafana
        volumes:
          - ./grafana_data:/var/lib/grafana
    networks:
      redisnet:
    

    6.git源码

    https://github.com/quguolin/docker/tree/master/redis
  • 相关阅读:
    CF(437C)The Child and Toy(馋)
    Android大放送干:书籍、过程、工具等各种全
    UVa 121
    ONOS系统架构演进,实现高可用性解决方案
    PowerDesigner 的常用小技巧 转
    现代团队必须是非常非常有活力、有激情同时又有向心力、有限属技能的团队。
    关于团队管理的心得体会 转
    Delphi 编译错误信息表
    财务基础 入门
    Sql Server CONVERT获取当前日期及日期样式
  • 原文地址:https://www.cnblogs.com/alin-qu/p/11746128.html
Copyright © 2020-2023  润新知