单机使用docker的host网络安装consul、registrator、consul-template构建高可用demo
docker consul registrator consul-template HA    2017-07-19 20:54:24    9   

compose文件:

version: '2'
services:
    consul-server:
        image: gliderlabs/consul-server:0.6
        command: -bootstrap -advertise 192.168.10.138
        hostname: consul-server
        ports:
            - "8400:8400"
            - "8500:8500"
            - "8600:53/udp"

    registrator:
        image: gliderlabs/registrator:latest
        command: consul://consul-server:8500
        hostname: registrator
        depends_on:
            - consul-server
        volumes:
            - /var/run/docker.sock:/tmp/docker.sock
    app:
      image: tutum/hello-world:latest
      environment:
        # Environment variables used by registrator to register services in consul
        SERVICE_NAME: app
        SERVICE_TAGS: sample
      ports:
        - "8081:80"
      depends_on:
        - consul-template-nginx
# Nginx Load Balancer
    consul-template-nginx:
      image: 1science/nginx:1.9.6-consul
      ports:
        - 80:80
      volumes:
        - ./etc/consul-template:/etc/consul-template
      # Change this section to point on your Consul
      environment:
        CONSUL_URL: consul-server:8500
        FILECONSUL_PREFIX: app
        FILECONSUL_DC: local
        FILECONSUL_BASEPATH: /app/etc
      depends_on:
        - registrator

etc目录附件:

http://pan.baidu.com/s/1boGrouz

 


 

by 刘迎光@萤火虫工作室
OpenBI交流群:495266201
MicroService 微服务交流群:217722918
mail: liuyg#liuyingguang.cn
博主首页(防止爬虫):http://blog.liuyingguang.cn
OpenBI问答社区:http://openbi.liuyingguang.cn/

Pre: imports golang.org/x/tools/go/vcs: unrecognized import path "golang.org/x/tools/

Next: Lucene 学习(一):简单demo


Table of content