zoukankan      html  css  js  c++  java
  • 微服务注册发现集群搭建—单机版(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自己封装的项目镜像
  • 相关阅读:
    8.2
    Telnet远程控制协议
    2020/6/29
    HCIA VRP基础命令(二)
    HCIA VRP基础命令(一)
    解决ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'报错问题
    nginx配置文件nginx.conf
    nginx服务器搭建
    FTP服务器
    NFS
  • 原文地址:https://www.cnblogs.com/taohaijun/p/8327877.html
Copyright © 2011-2022 走看看