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自己封装的项目镜像
  • 相关阅读:
    Kafka架构
    MapReduce执行流程解析
    ZooKeeper选举机制
    Zookeeper全局一致性
    HDFS的快照
    在CentOS 6.5上安装NodeJS
    Node v0.12.5 稳定版发布
    CentOS6.5手动升级gcc4.8.2
    centos6 yum 安装 install c++4.8 gcc4.8
    Linux CentOS6系统安装最新版本Node.js环境及相关文件配置
  • 原文地址:https://www.cnblogs.com/taohaijun/p/8327877.html
Copyright © 2011-2022 走看看