• 微服务注册发现集群搭建—单机版(Registrator+Consul+Consul-template+nginx)


    1.创建模板文件 docker-compose.yml
    #backend web application, scale this with docker-compose scale web=3
    web:
      image: tomcat-fhm:1.0
      environment:
        SERVICE_8080_NAME: my-web-server
        SERVICE_TAGS: backend-1
        MY_HOST: host-1
      ports:
      - "8080"
    
    #load balancer will automatically update the config using consul-template
    lb:
      image: liberalman/nginx-consul-template:latest
      hostname: lb
      links:
      - consulserver:consul
      ports:
      - "80:80"
    
    consulserver:
      image: progrium/consul:latest
      environment:
        SERVICE_TAGS: consul servers
      hostname: consulserver
      ports:
      - "8300"
      - "8400"
      - "8500:8500"
      - "53"
      command: -server -ui-dir /ui -data-dir /tmp/consul -bootstrap-expect 1
    
    # listen on local docker sock to register the container with public ports to the consul service
    registrator:
      image: gliderlabs/registrator:master
      hostname: registrator
      links:
      - consulserver:consul
      volumes:
      - "/var/run/docker.sock:/tmp/docker.sock"
      command: -internal consul://consul:8500
    2.启动
    docker-compose up
    3.关闭
    docker-compose down
    4.后台运行
    docker-compose up -d
    5.说明
    tomcat-fhm:1.0自己封装的项目镜像
  • 相关阅读:
    加载中动画
    跑步动画
    关键帧动画
    animate.css
    怪异盒子
    弹性项目属性
    改变元素大小
    Linux 文件系统 --磁盘I/O
    Linux 文件系统
    Sample Test Strategy
  • 原文地址:https://www.cnblogs.com/taohaijun/p/8327877.html
Copyright © 2020-2023  润新知