docker 健康监控

Springboot 健康监控

version: '3.6'
services:
  gateway:
    networks:
    - public
    - default
    healthcheck:
      test: ["CMD-SHELL", "curl -f http://localhost:4000 || exit 1"]
      interval: 1m30s
      timeout: 10s
      retries: 3
      start_period: 40s
    environment:
      CONFIG_SERVICE_PASSWORD: "password"
      REDIS_PASSWORD: "redispass"
    image: gateway:latest
    deploy:
      mode: replicated
      replicas: 4
      update_config:
        parallelism: 1
        failure_action: pause
        delay: 30s
        order: start-first
    ports:
    - 81:4000
    logging:
      options:
        max-size: "10m"
        max-file: "10"

rabbitmq监控监控

  rabbitmq:
    image: rabbitmq
    healthcheck:
      timeout: 5s
      interval: 5s
      retries: 5
      test:
        - "CMD"
        - "rabbitmqctl"
        - "status"

redis监控监控

  redis:
    image: redis:3.2.3
    healthcheck:
      timeout: 5s
      interval: 5s
      retries: 5
      test:
        - "CMD"
        - "bash"
        - "-c"
        - "exec 3<> /dev/tcp/127.0.0.1/6379 && echo PING >&3 && head -1 <&3 | grep PONG"

Leave a Comment

电子邮件地址不会被公开。 必填项已用*标注

Scroll to Top