• docker swarm 健康管理


    docker swarm 健康管理

    health  check在swarm中应用

    mkdir mynginx
    cd mynginx/
    vi Dockerfile
    写入以下内容
    FROM 192.168.172.128:5000/centos7 
    RUN yum -y install epel-release
    RUN yum -y install nginx
    COPY index.html /usr/share/nginx/html
    EXPOSE 80
    CMD ["nginx","-g","daemon off;"]
    docker build -t 192.168.172.128:5000/mynginx .
    docker run -dit --name test --health-cmd "curl --fail http://localhost/ || exit 1" --health-timeout 5s --health-interval 8s -p 80 192.168.172.128:5000/mynginx

     模拟不健康

    docker run -dit --name test2 --health-cmd "curl --fail http://localhost/opexit || exit 1" --health-timeout 5s --health-interval 8s -p 80 192.168.172.128:5000/mynginx

     创建secret

    openssl rand -base64 20  | docker secret create  my_secret2 -
     
    openssl rand -base64 20  > password.txt
    docker secret create my_secret3 password.tx

    创建自定义的overlay网络

    docker network  create -d overlay my_priv

    创建mysql  service

    docker service  create --name wpmysql --network my_priv  --secret source=my_secret2,target=mysql_root_password --secret source=my_secret3,target=mysql_user_password -e MYSQL_ROOT_PASSWORD_FILE="/run/secrets/mysql_root_password" -e MYSQL_PASSWORD_FILE="/run/secrets/mysql_user_password" -e MYSQL_USER="wordpress" -e MYSQL_DATABASE="wordpress" 192.168.172.128:5000/mysql

    验证:

     创建wordpress  service

     

  • 相关阅读:
    OpenWRT解决因PPPOE丢包导致频繁掉线问题
    ArcGIS Server 9.3集群部署(多som+多soc)
    ArcGIS Server 9.3集群部署(多som+多soc)
    POJ2823 滑动窗口
    AOJ 0531 坐标离散化
    Office2010安装错误
    Cv运动分析与对象跟踪(转)
    FPS学习记录
    opencv基于HSV的肤色分割
    Haar特征
  • 原文地址:https://www.cnblogs.com/cy888888/p/13267097.html
Copyright © 2020-2023  润新知