【swarm】swarm服务部署的编排文件

5 篇文章 0 订阅

用swarm集群形式部署MySQL服务

 

# cat mysql.yml

##########################################################

version: "3"
services:

  mysql:
    image: mysql:5.7.28
    deploy:
      replicas: 1
      resources:
        limits:
          cpus: '1'
          memory: 1G
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
      placement:
        constraints:
          - node.labels.key==value
    environment:
      - MYSQL_ROOT_PASSWORD: "MySQL@123"
    volumes:
      - /opt/mysqldata:/var/lib/mysql
    ports:
      - "3306:3306"
    logging:
      driver: gelf
      options:
        gelf-address: udp://logstash:12201

##NETWORK###
networks:
  default:
      driver: overlay

  nexus:
    image: sonatype/nexus3
    deploy:
      replicas: 1
      resources:
        limits:
          cpus: '1'
          memory: 2G
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
      placement:
        constraints:
        - node.labels.key==value
    volumes:
      - /opt/nexusdata:/nexus-data
    ports:
      - "8081:8081"

##NETWORK###
networks:
  default:
    driver: overlay
 

##########################################################

 

 


# docker stack deploy test -c docker.yml --with-registry-auth

 

# docker service ls 

 

 

 

参考

 

从docker单机到swarm模式的网络变化

https://www.jianshu.com/p/26e13631d625

 

Docker Swarm - 节点标签与服务约束

https://www.jianshu.com/p/2a11a40a9573

 

用docker swarm部署ELK日志系统

https://www.jianshu.com/p/ff4811c79985

 

CentOS7.x上swarm部署kong

https://www.jianshu.com/p/12b026dd006d

 

Send docker logs to ELK through gelf log driver

https://docs.docker.com/config/containers/logging/gelf

https://gist.github.com/eunomie/e7a183602b8734c47058d277700fdc2d#send-docker-logs-to-elk-through-gelf-log-driver

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值