首页 存档 技术 查看内容

微服务实践Docker与服务发现(二)

2018-3-30 13:00 |来自: 互联网 927 0

摘要: 架构师(JiaGouX)我们都是架构师! 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: t ...

架构师(JiaGouX)
我们都是架构师!


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=

声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋

相关分类

返回顶部