简体   繁体   English

了解docker swarm的高可用性

[英]Understanding docker swarm in terms of high availability

I am currently trying to understand what would be necessary to create a docker swarm to make some service highly available. 我目前正在尝试了解创建docker swarm以使某些服务具有高可用性所需的内容。 I read through a lot of the docker swarm documentation, but if my understanding is correct, docker swarm will just execute a service on any host. 我阅读了很多docker swarm文档,但如果我的理解是正确的,docker swarm将只在任何主机上执行服务。 What would happen if a host fails? 如果主机出现故障会发生什么? Would the swarm manager restart the service(s) running on that host/node on another one? 群集管理器会重新启动另一个主机/节点上运行的服务吗? Is there any better explanation of this than in the original documentation found here ? 有没有比这里找到的原始文件更好的解释?

Nothing more complex than that really. 没有比这更复杂的了。 Like it says, Swarm (and kubernetes, and most other tooling in this space) is declarative , which means that you tell it the state that you want (ie 'I want 4 instances of redis') and Swarm will converge the system to that state. 就像它说的那样,Swarm(和kubernetes,以及这个空间中的大多数其他工具)是声明性的 ,这意味着你告诉它你想要的状态(即'我想要4个redis实例')和Swarm会将系统聚合到那个州。 If you have 3 nodes, then it will schedule 1 redis on Node 1, 1 on Node 2, and 2 on Node 3. If Node 2 dies, then the system is now not 'compliant' with your declared state, and Swarm will schedule another redis on Node 1 or 3 (depending on strategy, etc...). 如果你有3个节点,那么它将在节点1上安排1个redis,在节点2上安排1个,在节点3上安排2个。如果节点2死亡,那么系统现在不符合你声明的状态,并且Swarm将安排节点1或3上的另一个redis(取决于策略等)。

Now this dynamism of container / task / instance scheduling brings another problem, discovery. 现在,容器/任务/实例调度的这种动态带来了另一个问题,即发现。 Swarm deals with this by maintaining an internal DNS registry and by creating VIP (virtual IPs) for each service. Swarm通过维护内部DNS注册表和为每个服务创建VIP(虚拟IP)来处理此问题。 Instead of having to address / keep track of each redis instance, I can instead point to a service alias and Swarm will automatically route traffic to where it needs to go. 我可以改为指向服务别名,而不是必须处理/跟踪每个redis实例,而Swarm会自动将流量路由到需要去的地方。

Of course there are also other considerations: 当然还有其他考虑因素:

  • Can your service support multiple backend instances? 您的服务可以支持多个后端实例吗? Is it stateless? 它是无国籍的吗? Sessions? 会议? Cache? 缓存? Etc... 等等...
  • What is 'HA'? 什么是'HA'? Multi-node? 多节点? Multi-AZ? 多AZ? Multi-region? 多区域? Etc... 等等...

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

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