微服务实践——Docker与服务发现

MireyaKirkw 8年前

Docker Java App Load Balanced By Nginx Or Apache HTTP, Mongo Replica Set And Hazelcast Cluster

背景

为了发挥Docker在跨多个服务器的分布式应用程序的部署(甚至是跨区域)的能力,人们不应该限制哪些服务进到哪个服务器。动态可扩展性(或自动缩放)的关键环境的要求(如生产环境)不只是适用于新的微服务架构设计。也适用于典型的单片应用程序的部署。如果这些服务绑定在特定的服务器上,那么这些程序的未来的可扩展性是很困难的。

为了能够实现服务发现,我们需要满足以下条件:

  • Service registration  在服务器上保存这些正在运行服务的端口。
  • Service discovery  实现发现我们在服务器保存在注册过程中的信息

我们还要实现强的服务,以满足企业级对服务发现的要求。包括以下这些问题:

  • 我们如何注销停止工作的服务?
  • 我们如何对这些”发现了的”服务实施负载均衡?
  • 如果服务在横向扩展或者缩放的过程中被删除了怎么办?

大多数典型的服务发现工具拥有某种高度可用的分布式(key/value)存储,大家可以参考阅读这篇博客 http://technologyconversations.com/2015/09/08/service-discovery-zookeeper-vs-etcd-vs-consul/

这些工具的主要缺点是他们自己在容器中运行对第三方工具的依赖。为了使用Consul,打个比方。一个用户需要在程序中使用Consul 和Registrator 容器-这一定会使容器的数量增加。那么用户就需要管理这些容器。

DCHQ,从另一方面说。如果使用代理来协调服务注册和服务发现。把信息存储在底层DCHQ数据库。这意味着我们不需要附加的容器。另外,服务发现框架,允许用户自定义某些事件需要被执行的同时,利用的不只是IP和应用程序中的其他容器的主机名的信息提供了更大的灵活性。在部署的时候使用的也是环境变量的值。

这并不等于说服务发现框架使用DHCQ就能完全替代其它工具,最好的工具还是能够满足业务的需求。

在这篇blog中,我们将介绍使用Docker部署3个服务发现的程序,包括: Nginx & Apache HTTP Server load balancing , Mongo Replica Set and Hazelcast Cluster .

包括以下内容:

  • 构建能够在任意Linux 主机上面运行的YAML-based 程序模板
  • 在任何云基础架构上的配置和自动扩展(本文我们以Microsoft Azure为例)
  • 在Microsoft Azure集群部署分布式,高可用性应用程序
  • 监控运行容器的 CPU, Memory & I/O
  • Tomacat 应用服务集群扩展
  • MongoDB的分片服务扩展
  • Hazelcast 集群扩展

构建能够在任意Linux 主机上面运行的YAML-based 程序模板

用户一旦登录到DCHQ (either the hosted DCHQ.io or on-premise version),用户可以导航到 Manage > App/Machine,然后可以点击 +创建新的 Docker Compose模板

我们使用 Docker Hub官方镜像创建了5  个程序的模板

这些模板包括了一下程序栈:

  • Multi-Tier Java Application with Nginx, Tomcat, Solr and Mongo — using Consul and Registrator for service discovery
  • Multi-Tier Java Application with Nginx, Tomcat, Solr and Mongo — using DCHQ’s service discovery framework
  • Multi-Tier Java Application with Apache HTTP Server, Tomcat, Solr, and Cassandra) — using DCHQ’s service discovery framework
  • Mongo Replica Set — using DCHQ’s service discovery framework
  • Hazelcast Cluster — using DCHQ’s service discovery framework

更多关于Docker application modeling in DCHQ的资料可以访问: http://dchq.co/docker-compose.html

更多关于Docker service discovery in DCHQ的资料可以访问: http://dchq.co/docker-service-discovery.html

Request Time & Post-Provision 的Web Servers 和 Application Servers配置插件

通过这些程序的模板,你会发现一些容器为了配置容器会调用Bash脚本插件。这些脚本对post-provision操作执行的非常好。

这些插件可以在 Manage > Plug-ins导航中创建,一旦这些脚本启动是,DHCQ代理服务会执行这些容器里面的脚本。用户可以指定一个能被在请求之后被覆盖的参数。在$符号之前的都可以被成为参数,比如: $file_url 可以是一个参数,它允许开发者指定的网址下载一个WAR文件,还可以在当用户希望更新运行在容器上例如Java WAR文件请求时间和后规定被覆盖:

该插件ID需要在定义YAML应用程序模板时候提供,例如:调用Nginxbash脚本插件。我们可以参照下面的plug-in ID:

Nginx:    image: nginx:latest    publish_all: true    mem_min: 50m    host: host1    plugins:      - !plugin        id: 0H1Nk        restart: true        lifecycle: on_create, post_scale_out:AppServer, post_scale_in:AppServer, post_stop:AppServer, post_start:AppServer        arguments:          # Use container_private_ip if you're using Docker networking          - servers=server {{AppServer | container_private_ip}}:8080;          # Use container_hostname if you're using Weave networking          #- servers=server {{AppServer | container_hostname}}:8080;
Nginx:    image: nginx:latest    publish_all: true    mem_min: 50m    host: host1    plugins:      - !plugin        id: 0H1Nk        restart: true        lifecycle: on_create, post_scale_out:AppServer, post_scale_in:AppServer, post_stop:AppServer, post_start:AppServer        arguments:          # Use container_private_ip if you're using Docker networking          - servers=server {{AppServer | container_private_ip}}:8080;          # Use container_hostname if you're using Weave networking          #- servers=server {{AppServer | container_hostname}}:8080;

你会发现,同样的Nginx插件,在不同的阶段得到了执行。

  • 当 Nginx 容器 创建的时候  — 在这种情况下, 应用程序的容器IP会被注入到默认配置文件下面。以便实现服务的负载均衡。
  • 当应用程序服务集群需要缩放或者扩展的时候 — 在这种情况下, 更新后应用程序容器的IP地址会被注入到默认的配置文件中,以便更好的实现负载均衡。
  • 当应用程序停止或者启动时— 在这种情况下,更新后应用程序容器的IP地址会被注入到默认的配置文件中,以便更好的实现负载均衡。

然而这里的服务发现框架同时做着服务发现和服务注册的事情。

服务发现插件的生命周期

  • on_create — executes the plug-in when creating the container
  • on_start — executes the plug-in after a container starts
  • on_stop — executes the plug-in before a container stops
  • on_destroy — executes the plug-in before destroying a container
  • post_create — executes the plug-in after the container is created and running
  • post_start[:Node] — executes the plug-in after another container starts
  • post_stop[:Node] — executes the plug-in after another container stops
  • post_destroy[:Node] — executes the plug-in after another container is destroyed
  • post_scale_out[:Node] — executes the plug-in after another cluster of containers is scaled out
  • post_scale_in[:Node] — executes the plug-in after another cluster of containers is scaled in

要访问Nginx, Apache HTTP Server (httpd), Mongo Replica Set, and Hazelcast Cluster需要遵循EULA许可。

配置部署在多台主机HA的cluster_size与host 参数

  • host1, host2, host3 , etc. – selects a host randomly within a data-center (or cluster) for container deployments
  • IP Address 1, IP Address 2, etc. — allows a user to specify the actual IP addresses to use for container deployments
  • Hostname 1, Hostname 2, etc. — allows a user to specify the actual hostnames to use for container deployments
  • Wildcards (e.g. “db- ”, or “app-srv- ”) – to specify the wildcards to use within a hostname

通过镜像绑定环境变量

  • {{alphanumeric | 8}} – creates a random 8-character alphanumeric string. This is most useful for creating random passwords.
  • {{Image Name | ip}} – allows you to enter the host IP address of a container as a value for an environment variable. This is most useful for allowing the middleware tier to establish a connection with the database.
  • {{Image Name | container_ip}} – allows you to enter the name of a container as a value for an environment variable. This is most useful for allowing the middleware tier to establish a secure connection with the database (without exposing the database port).
  • {{Image Name | container_private_ip}} – allows you to enter the internal IP of a container as a value for an environment variable. This is most useful for allowing the middleware tier to establish a secure connection with the database (without exposing the database port).
  • {{Image Name | port_Port Number}} – allows you to enter the Port number of a container as a value for an environment variable. This is most useful for allowing the middleware tier to establish a connection with the database. In this case, the port number specified needs to be the internal port number – i.e. not the external port that is allocated to the container. For example, {{PostgreSQL | port_5432}} will be translated to the actual external port that will allow the middleware tier to establish a connection with the database.
  • {{Image Name | Environment Variable Name}} – allows you to enter the value an image’s environment variable into another image’s environment variable. The use cases here are endless – as most multi-tier applications will have cross-image dependencies.

构建 Nginx Docker 镜像的 Consul

  • Git URLhttps://github.com/dchqinc/nginx-consul.git
  • Git Branch – this field is optional — but a user can specify a branch from a GitHub project. The default branch is master.
  • Git Credentials – a user can store the credentials to a private GitHub repository securely in DCHQ. This can be done by navigating to Manage > Cloud Providers and Repos and clicking on the + to select Credentials
  • Cluster – the building of Docker images is orchestrated through the DCHQ agent. As a result, a user needs to select a cluster on which an agent will be used to execute the building of Docker images. If a cluster has not been created yet, please refer to this section to either register already running hosts or automate the provisioning of new virtual infrastructure.
  • Push to Registry – a user can push the newly created image on either a public or private repository on Docker Hub or Quay. To register a Docker Hub or Quay account, a user should navigate to Manage > Cloud Providers and clicking on the + to select Docker Registries
  • Repository – this is the name of the repository on which the image will be pushed. For example, our image was pushed to dchq/nginx-consul:latest
  • Tag – this is the tag name that you would like to give for the new image. The supported tag names in DCHQ include:
    • {{date}} — formatted date
    • {{timestamp}} — the full time-stamp
    </li>
  • Cron Expression – a user can schedule the building of Docker images using out-of-box cron expressions. This facilitates daily and nightly builds for users.
  • </ul>

    Multi-Tier Java (Consul-Nginx-Tomcat-Solr-Mongo)

    Nginx:    image: dchq/nginx-consul:latest    publish_all: true    mem_min: 50m    host: host1    plugins:      - !plugin        id: GINmu        restart: true        lifecycle: on_create        arguments:          - APPSERVER_IP={{AppServer | container_private_ip}}          - SERVICE_NAME={{AppServer | SERVICE_NAME}}          - SERVICE_TAGS={{AppServer | SERVICE_TAGS}}          - CONSUL_IP={{Consul | container_private_ip}}    AppServer:    image: tomcat:8.0.21-jre8    mem_min: 600m    host: host1    cluster_size: 1    environment:      - mongo_url={{Mongo|container_private_ip}}:27017/dchq      - solr_host={{Solr|container_private_ip}}      - solr_port=8983      - SERVICE_NAME=app      - SERVICE_TAGS=production    plugins:      - !plugin        id: oncXN        restart: true        arguments:          - file_url=https://github.com/dchqinc/dchq-docker-java-solr-mongo-cassandra-example/raw/master/dbconnect.war          - dir=/usr/local/tomcat/webapps/ROOT.war          - delete_dir=/usr/local/tomcat/webapps/ROOT  Consul:    image: progrium/consul:latest    host: host1    ports:      - "8300:8300"      - "8400:8400"      - "8500:8500"      - "8600:53/udp"      command: -server -bootstrap -advertise 10.0.2.15    Registrator:    image: gliderlabs/registrator:latest    host: host1    command: consul://<HOST_IP>:8500    volumes:      - "/var/run/docker.sock:/tmp/docker.sock"    Solr:    image: solr:latest    mem_min: 300m    host: host1    publish_all: false    plugins:      - !plugin        id: doX8s        restart: true        arguments:          - file_url=https://github.com/dchqinc/dchq-docker-java-solr-mongo-cassandra-example/raw/master/names.zip  Mongo:    image: mongo:latest    host: host1    mem_min: 400m
    Nginx:    image: dchq/nginx-consul:latest    publish_all: true    mem_min: 50m    host: host1    plugins:      - !plugin        id: GINmu        restart: true        lifecycle: on_create        arguments:          - APPSERVER_IP={{AppServer | container_private_ip}}          - SERVICE_NAME={{AppServer | SERVICE_NAME}}          - SERVICE_TAGS={{AppServer | SERVICE_TAGS}}          - CONSUL_IP={{Consul | container_private_ip}}     AppServer:    image: tomcat:8.0.21-jre8    mem_min: 600m    host: host1    cluster_size: 1    environment:      - mongo_url={{Mongo|container_private_ip}}:27017/dchq      - solr_host={{Solr|container_private_ip}}      - solr_port=8983      - SERVICE_NAME=app      - SERVICE_TAGS=production    plugins:      - !plugin        id: oncXN        restart: true        arguments:          - file_url=https://github.com/dchqinc/dchq-docker-java-solr-mongo-cassandra-example/raw/master/dbconnect.war          - dir=/usr/local/tomcat/webapps/ROOT.war          - delete_dir=/usr/local/tomcat/webapps/ROOT  Consul:    image: progrium/consul:latest    host: host1    ports:      - "8300:8300"      - "8400:8400"      - "8500:8500"      - "8600:53/udp"      command: -server -bootstrap -advertise 10.0.2.15     Registrator:    image: gliderlabs/registrator:latest    host: host1    command: consul://<HOST_IP>:8500    volumes:      - "/var/run/docker.sock:/tmp/docker.sock"     Solr:    image: solr:latest    mem_min: 300m    host: host1    publish_all: false    plugins:      - !plugin        id: doX8s        restart: true        arguments:          - file_url=https://github.com/dchqinc/dchq-docker-java-solr-mongo-cassandra-example/raw/master/names.zip  Mongo:    image: mongo:latest    host: host1    mem_min: 400m

    Multi-Tier Java (ApacheLB-Tomcat-Solr-Mongo)

    HTTP-LB:    image: httpd:latest    publish_all: true    mem_min: 50m    host: host1    plugins:      - !plugin        id: uazUi        restart: true        lifecycle: on_create, post_scale_out:AppServer, post_scale_in:AppServer        arguments:          # Use container_private_ip if you're using Docker networking          - BalancerMembers=BalancerMember http://{{AppServer | container_private_ip}}:8080          # Use container_hostname if you're using Weave networking          #- BalancerMembers=BalancerMember http://{{AppServer | container_hostname}}:8080  AppServer:    image: tomcat:8.0.21-jre8    mem_min: 600m    host: host1    cluster_size: 1    environment:      - mongo_url={{Mongo|container_private_ip}}:27017/dchq      - solr_host={{Solr|container_private_ip}}      - solr_port=8983    plugins:      - !plugin        id: oncXN        restart: true        arguments:          - file_url=https://github.com/dchqinc/dchq-docker-java-solr-mongo-cassandra-example/raw/master/dbconnect.war          - dir=/usr/local/tomcat/webapps/ROOT.war          - delete_dir=/usr/local/tomcat/webapps/ROOT  Solr:    image: solr:latest    mem_min: 300m    host: host1    publish_all: false    plugins:      - !plugin        id: doX8s        restart: true        arguments:          - file_url=https://github.com/dchqinc/dchq-docker-java-solr-mongo-cassandra-example/raw/master/names.zip  Mongo:    image: mongo:latest    host: host1    mem_min: 400m
    HTTP-LB:    image: httpd:latest    publish_all: true    mem_min: 50m    host: host1    plugins:      - !plugin        id: uazUi        restart: true        lifecycle: on_create, post_scale_out:AppServer, post_scale_in:AppServer        arguments:          # Use container_private_ip if you're using Docker networking          - BalancerMembers=BalancerMemberhttp://{{AppServer | container_private_ip}}:8080          # Use container_hostname if you're using Weave networking          #- BalancerMembers=BalancerMember http://{{AppServer | container_hostname}}:8080  AppServer:    image: tomcat:8.0.21-jre8    mem_min: 600m    host: host1    cluster_size: 1    environment:      - mongo_url={{Mongo|container_private_ip}}:27017/dchq      - solr_host={{Solr|container_private_ip}}      - solr_port=8983    plugins:      - !plugin        id: oncXN        restart: true        arguments:          - file_url=https://github.com/dchqinc/dchq-docker-java-solr-mongo-cassandra-example/raw/master/dbconnect.war          - dir=/usr/local/tomcat/webapps/ROOT.war          - delete_dir=/usr/local/tomcat/webapps/ROOT  Solr:    image: solr:latest    mem_min: 300m    host: host1    publish_all: false    plugins:      - !plugin        id: doX8s        restart: true        arguments:          - file_url=https://github.com/dchqinc/dchq-docker-java-solr-mongo-cassandra-example/raw/master/names.zip  Mongo:    image: mongo:latest    host: host1    mem_min: 400m

    Multi-Tier Java (Nginx-Tomcat-Solr-MySQL)

    Nginx:    image: nginx:latest    publish_all: true    mem_min: 50m    host: host1    plugins:      - !plugin        id: 0H1Nk        restart: true        lifecycle: on_create, post_scale_out:AppServer, post_scale_in:AppServer        arguments:          # Use container_private_ip if you're using Docker networking          - servers=server {{AppServer | container_private_ip}}:8080;          # Use container_hostname if you're using Weave networking          #- servers=server {{AppServer | container_hostname}}:8080;  AppServer:    image: tomcat:8.0.21-jre8    mem_min: 600m    host: host1    cluster_size: 1    environment:      - database_driverClassName=com.mysql.jdbc.Driver      - database_url=jdbc:mysql://{{MySQL|container_hostname}}:3306/{{MySQL|MYSQL_DATABASE}}      - database_username={{MySQL|MYSQL_USER}}      - database_password={{MySQL|MYSQL_ROOT_PASSWORD}}      - solr_host={{Solr|container_private_ip}}      - solr_port=8983    plugins:      - !plugin        id: oncXN        restart: true        arguments:          - file_url=https://github.com/dchqinc/dchq-docker-java-solr-mongo-cassandra-example/raw/master/dbconnect.war          - dir=/usr/local/tomcat/webapps/ROOT.war          - delete_dir=/usr/local/tomcat/webapps/ROOT  Solr:    image: solr:latest    mem_min: 300m    host: host1    publish_all: false    plugins:      - !plugin        id: doX8s        restart: true        arguments:          - file_url=https://github.com/dchqinc/dchq-docker-java-solr-mongo-cassandra-example/raw/master/names.zip  MySQL:    image: mysql:latest    host: host1    mem_min: 400m    environment:      - MYSQL_USER=root      - MYSQL_DATABASE=names      - MYSQL_ROOT_PASSWORD={{alphanumeric|8}}
    Nginx:    image: nginx:latest    publish_all: true    mem_min: 50m    host: host1    plugins:      - !plugin        id: 0H1Nk        restart: true        lifecycle: on_create, post_scale_out:AppServer, post_scale_in:AppServer        arguments:          # Use container_private_ip if you're using Docker networking          - servers=server {{AppServer | container_private_ip}}:8080;          # Use container_hostname if you're using Weave networking          #- servers=server {{AppServer | container_hostname}}:8080;  AppServer:    image: tomcat:8.0.21-jre8    mem_min: 600m    host: host1    cluster_size: 1    environment:      - database_driverClassName=com.mysql.jdbc.Driver      - database_url=jdbc:mysql://{{MySQL|container_hostname}}:3306/{{MySQL|MYSQL_DATABASE}}      - database_username={{MySQL|MYSQL_USER}}      - database_password={{MySQL|MYSQL_ROOT_PASSWORD}}      - solr_host={{Solr|container_private_ip}}      - solr_port=8983    plugins:      - !plugin        id: oncXN        restart: true        arguments:          - file_url=https://github.com/dchqinc/dchq-docker-java-solr-mongo-cassandra-example/raw/master/dbconnect.war          - dir=/usr/local/tomcat/webapps/ROOT.war          - delete_dir=/usr/local/tomcat/webapps/ROOT  Solr:    image: solr:latest    mem_min: 300m    host: host1    publish_all: false    plugins:      - !plugin        id: doX8s        restart: true        arguments:          - file_url=https://github.com/dchqinc/dchq-docker-java-solr-mongo-cassandra-example/raw/master/names.zip  MySQL:    image: mysql:latest    host: host1    mem_min: 400m    environment:      - MYSQL_USER=root      - MYSQL_DATABASE=names      - MYSQL_ROOT_PASSWORD={{alphanumeric|8}}

    Mongo Replica Set Cluster

    mongo_rs1_srv1:    image: mongo:latest    mem_min: 400m    publish_all: true    command: --replSet rs1    environment:      # inject clustered node ips      - MONGO_RS1_SRV2_IP={{mongo_rs1_srv2|container_private_ip}}      # The above mapping will insert comma separated ip list e.g. 10.1.1.1,10.1.12    plugins:      - !plugin        # This plugin initializes the Replica Set        lifecycle: on_create        id: QX25F      - !plugin        # This plug-in re-balances the Replica Set post scale out        lifecycle: post_scale_out:mongo_rs1_srv2        id: sxKM9      - !plugin        # This plug-in re-balances the Replica Set post scale in        lifecycle: post_scale_in:mongo_rs1_srv2        id: YIALH  # Define this node as clustered  mongo_rs1_srv2:    image: mongo:latest    mem_min: 400m    cpu_shares: 1    cluster_size: 2    command: --replSet rs1
    mongo_rs1_srv1:    image: mongo:latest    mem_min: 400m    publish_all: true    command: --replSetrs1    environment:      # inject clustered node ips      - MONGO_RS1_SRV2_IP={{mongo_rs1_srv2|container_private_ip}}      # The above mapping will insert comma separated ip list e.g. 10.1.1.1,10.1.12    plugins:      - !plugin        # This plugin initializes the Replica Set        lifecycle: on_create        id: QX25F      - !plugin        # This plug-in re-balances the Replica Set post scale out        lifecycle: post_scale_out:mongo_rs1_srv2        id: sxKM9      - !plugin        # This plug-in re-balances the Replica Set post scale in        lifecycle: post_scale_in:mongo_rs1_srv2        id: YIALH  # Define this node as clustered  mongo_rs1_srv2:    image: mongo:latest    mem_min: 400m    cpu_shares: 1    cluster_size: 2    command: --replSetrs1

    Hazelcast Cluster

    Hazelcast-Management-Center:    image: hazelcast/management-center:latest    # Use this configuration if deploying to a shared VM    publish_all: true    # (Recommended) Use this configuration if deploying to a dedicated VM    #ports:    #  - 8080:8080    host: host1    environment:      - HAZELCAST_IP={{Hazelcast | container_private_ip}}  Hazelcast:    image: hazelcast/hazelcast:latest    # Use this configuration if deploying to a shared VM    publish_all: true    # (Recommended) Use this configuration if deploying to a dedicated VM    #ports:    #  - 5701:5701    cluster_size: 1    host: host1    plugins:      - !plugin        id: Qgp4H        lifecycle: post_create, post_scale_out:Hazelcast, post_scale_in:Hazelcast        restart: true        arguments:          # Use this configuration if deploying to a shared VM          - Hazelcast_IP=<member>{{Hazelcast | container_private_ip}}</member>          # (Recommended) Use this configuration if deplying to a dedicated VM          #- Hazelcast_IP=<member>{{Hazelcast | ip}}</member>          - Management_Center_URL=http://{{Hazelcast-Management-Center | ip}}:{{Hazelcast-Management-Center | port_8080}}/mancenter    environment:      # Uncomment the line below to specify the heap size      #- MIN_HEAP_SIZE="1g"       # Uncomment the line below to provide your own hazelcast.xml file      - JAVA_OPTS=-Dhazelcast.config=/opt/hazelcast/hazelcast.xml    volumes:      # Uncomment the line below if you plan to use your own hazelcast.xml file      #- ./configFolder:./configFolder
    Hazelcast-Management-Center:    image: hazelcast/management-center:latest    # Use this configuration if deploying to a shared VM    publish_all: true    # (Recommended) Use this configuration if deploying to a dedicated VM    #ports:    #  - 8080:8080    host: host1    environment:      - HAZELCAST_IP={{Hazelcast | container_private_ip}}  Hazelcast:    image: hazelcast/hazelcast:latest    # Use this configuration if deploying to a shared VM    publish_all: true    # (Recommended) Use this configuration if deploying to a dedicated VM    #ports:    #  - 5701:5701    cluster_size: 1    host: host1    plugins:      - !plugin        id: Qgp4H        lifecycle: post_create, post_scale_out:Hazelcast, post_scale_in:Hazelcast        restart: true        arguments:          # Use this configuration if deploying to a shared VM          - Hazelcast_IP=<member>{{Hazelcast | container_private_ip}}</member>          # (Recommended) Use this configuration if deplying to a dedicated VM          #- Hazelcast_IP=<member>{{Hazelcast | ip}}</member>          - Management_Center_URL=http://{{Hazelcast-Management-Center | ip}}:{{Hazelcast-Management-Center | port_8080}}/mancenter    environment:      # Uncomment the line below to specify the heap size      #- MIN_HEAP_SIZE="1g"      # Uncomment the line below to provide your own hazelcast.xml file      - JAVA_OPTS=-Dhazelcast.config=/opt/hazelcast/hazelcast.xml    volumes:      # Uncomment the line below if you plan to use your own hazelcast.xml file      #- ./configFolder:./configFolder

    实现Docker配置和自动扩展的基础设施

    一旦应用程序被保存,用户可以注册一个云服务提供商自动Docker集群的配置和自动缩放的功能。在不止18种云服务上,包括VMware vSphere, OpenStack, CloudStack, Amazon Web Services, Rackspace, Microsoft Azure, DigitalOcean, IBM SoftLayer, Google Compute Engine等

    这里有一些主流云平台的资料:

    英文原文: https://www.voxxed.com/blog/2016/01/docker-service-discovery-microsoft-azure/?ref=dzone

    微服务实践——Docker与服务发现

    </div>

    来自: https://xiequan.info/在docker上运行微服务实践/