简体   繁体   English

使用Docker部署集群(即MongoDb / ElasticSearch)并链接到Java应用程序

[英]Deploying a cluster (i.e. MongoDb / ElasticSearch) with Docker and linking to Java Application

I need to deploy a Java microservice which interacts with an high-available back-end, such as ElasticSearch or Mongodb. 我需要部署与高可用后端(例如ElasticSearch或Mongodb)交互的Java微服务。

  • What is the idiomatic way to deploy a cluster of an high-available backend such as ElasticSearch or MongoDb and then pass the information to a dockerized microservice? 部署高可用性后端集群(例如ElasticSearch或MongoDb)然后将信息传递给dockerized微服务的惯用方式是什么?
  • Port and container links seems to tie the application to be always deployed with docker, is that a significant drawback? 端口和容器链接似乎将应用程序始终与docker绑定在一起,这是一个重大缺点吗?
  • Is there an idiomatic way to retrieve the ip of the machines and pass them to the container running the microservice? 是否有惯用的方法来检索机器的ip并将它们传递给运行微服务的容器?

Since docker 1.9, the new idiomatic way would be to run a discovery service like Consul , in order to record any container and advertise it to other containers. 从docker 1.9开始,新的惯用方式将是运行诸如Consul之类的发现服务,以便记录任何容器并将其广告给其他容器。 No more links. 没有更多链接。

See an example in " Atlassian Orchestration with Docker: multi-host support for the win! ". 请参阅“使用Atlassian Orchestration与Docker:多主机支持! ”中的示例。
You isolate your different services on a 3-node Swarm cluster : 您可以在3节点Swarm群集上隔离不同的服务:

https://developer.atlassian.com/blog/2015/12/atlassian-docker-orchestration/arch.png

The idea behind using swarm and different nodes is that you can allocate different constraints per node (in term of memory) in order to assign the right service to the right node. 使用群体和不同节点的想法是,您可以为每个节点分配不同的约束(就内存而言),以便将正确的服务分配给正确的节点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM