Cloud Foundry是业界领先的开源PaaS平台,它的内核采用Ruby开发。设计上使用以NATS消息系统为核心的松耦合组件架构,强调以NATS消息系统为核心的松耦合组件架构所带来的弹性。
NATS
一个轻量级的 发布-订阅, 分布式队列消息系统,基于EventMachine开发。
本文重点将列出CF系统中,都有哪些 "NATS MESSAGES",并且对其功能做简单介绍。
Cloud Controller
NATS MESSAGES
- Publish: dea.discover
- Publish: dea.find.droplet
- Publish: dea.locate
- Publish: dea.start
- Publish: dea.stop
- Publish: dea.update
- Publish: droplet.updated
- Publish: healthmanager.health
- Publish: healthmanager.status
- Publish: router.register
- Publish: router.unregister
- Publish: vcap.cc.events
- Publish: vcap.component.announce
- Publish: vcap.stager.{queue}
- Subscribe: cloudcontroller.bulk.credentials
- Subscribe: cloudcontrollers.hm.requests
- Subscribe: dea.advertise
- Subscribe: router.start
- Subscribe: vcap.component.discover
DEA
Droplet Execution Agent(简称DEA),对运行在Cloud Foundry上的所有app的运行实例进行管理。
NATS MESSAGES
- Publish: dea.advertise
- Publish: dea.heartbeat
- Publish: dea.start
- Publish: droplet.exited
- Publish: router.register
- Publish: router.unregister
- Publish: vcap.component.announce
- Subscribe: dea.discover
- Subscribe: dea.find.droplet
- Subscribe: dea.locate
- Subscribe: dea.status
- Subscribe: dea.stop
- Subscribe: dea.update
- Subscribe: dea.{uuid}.start
- Subscribe: droplet.status
- Subscribe: healthmanager.start
- Subscribe: router.start
- Subscribe: vcap.component.discover
- 整体结构更加模块化
- EM/fiber 对并发更友好
- Warden 的支持
- 文件目录的下载支持
Health Manager 监控在DEA中所有app的运行情况,并且可以根据不同情况给Cloud Controller 发出指令做出相应调整。比如:如果某个droplet发生异常退出,Health Manager 就可以告诉Cloud Controller 重启这个droplet。
NATS MESSAGES
Router
Router模块 处理HTTP 请求,将请求转发到具体的运行于DEA中的app实例。它可以根据不同实例的URIs,监听实例的可用性。请求发出后能够匹配到指定的app, 再到这个app具体的实例。
NATS MESSAGES
Stager
当上传应用时,Stager 负责将app打包(package)。这过程由Cloud Controller 触发,并由某一特定的 staging 插件 完成。过程完成后'报告'给Cloud Controller 。
NATS MESSAGES
Service Gateway
The Service Gateway is the main communcation channel for the Cloud Controller to interact with different services. The Service Gateways report to the Cloud Controller their availability and status, and the Cloud Controller makes requests back to them in order provision requested services.
The Service Gateways then communcate with the available Service Nodes to provision services and track which ones are already provisioned.
NATS MESSAGES
Service Node
Service Nodes sit behind the Service Gateways. They typically deal with the finer details of provisioning the request service, such as setting up the MySQL database or starting a Redis instance.
You will normally have multiple Service Nodes reporting to a Service Gateway. The nodes are independent of each, while the gateways may be singular or in a clustered pair for high availability.