当前位置:网站首页>9.集群之间服务通信 RoutingMesh
9.集群之间服务通信 RoutingMesh
2020-11-07 16:43:00 【太猪-YJ】
创建overlay网关
docker network create -d overlay demo
docker network ls
NETWORK ID NAME DRIVER SCOPE
7a511becede2 bridge bridge local
im7c34k0bfxh demo overlay swarm
37856c9de79d docker_gwbridge bridge local
c438996bf1e8 host host local
idnr3c47eum5 ingress overlay swarm
a785589db128 lb-scale_default bridge local
14865f2115c6 none null local
e9bba04074f1 wordpress_my-bridge bridge local
创建Service使用network为overlay
如上图所示,我们有三个应用,两个service一个client。它们可能部署在同一个worker node上,也可能分开部署。上图中这三个应用,同时部署在了127.0.0.11这个节点上。client想要访问service应用,可以通过ip+端口号的形式,也可以通过应用名称来访问。是怎么做到的呢?docker engine里有一个DNS服务,它整理了所有应用的名称与IP地址映射关系,但是Docker DNS服务里的生成和存储的IP地址,不是应用所在容器的IP地址,应用都是部署在127.0.0.11节点上的,但是我们看到DNS里存储的ip地址是10.0.3/4/5,这是虚拟IP,VIP。因为部署应用的容器地址因为宕机或者扩容而变化,DNS给应用分配一个虚拟IP,这个虚拟IP是不会变的。这样应用通过虚拟IP互相访问,再通过LVS去实现的。
nslookup www.baidu.com/service name
可以查看域名对应的ip地址,如果域名做了集群部署,是负载均衡的,也会显示多个ip地址。
1.我们在容器中部署应用的时候,需要给应用指定network,network必须是overlay网络协议,这样子swarm的DNS才会使用vip来互相通信。
2.如果部署的应用绑定了接口,即使它部署在某一个节点上,也可以通过访问swarm里的其他节点的此端口号,来访问到应用。
版权声明
本文为[太猪-YJ]所创,转载请带上原文链接,感谢
https://my.oschina.net/xiaoyoung/blog/4706937
边栏推荐
- python3操作Jenkins模块api
- Detailed software engineering -- the necessary graphs in each stage
- 如何创建交互式内核密度图表
- 20个XR项目路演,近20个资本机构出席!诚邀您参加2020 Qualcomm XR生态合作伙伴大会
- Stm32f030k6t6 compatible replacement smart mm32f031k6t6
- 如何才能快速正确的部署甘特图
- New features of vue3
- The essence of transaction and the principle of deadlock
- 移动端像素适配方案
- 10000! Ideal car recalls all defective cars: 97 accidents have occurred and losses will be expanded
猜你喜欢
pc端与移动端适配解决方案之rem
September 9, 2020: naked writing algorithm: two threads print numbers 1-100 in turn.
The memorandum model of behavior model
Jenkins入门(二)声明式流水线Jenkins Pipeline
2020-08-17: how to solve data skew in detail?
idea 激活到 2089 失效
python3操作Jenkins模块api
汽车维修app开发的好处与功能
10000! Ideal car recalls all defective cars: 97 accidents have occurred and losses will be expanded
Empty test suite appears in JUnit test
随机推荐
Jenkins pipline stage setting timeout
Python3 operating gitlab
Jenkins installation and deployment process
The first choice for lightweight GPU applications is the NVIDIA vgpu instance launched by Jingdong Zhilian cloud
Cloudquery v1.2.0 release
JS array the usage of array is all here (array method reconstruction, array traversal, array de duplication, array judgment and conversion)
Interviewer: how about shardingsphere
条形码识别器Dynamsoft Barcode Reader v7.5全新上线!
Developing STM32 USB with cubemx
Benefits and functions of auto maintenance app development
ado.net and asp.net The relationship between
The memorandum model of behavior model
Unexpected element.. required element
Method of code refactoring -- Analysis of method refactoring
Mongo user rights login instruction
小程序商城系统插件代码该如何写?怎么用代码检查添加插件是否成功?
[doodling the footprints of Internet of things] Introduction to Internet of things
How to add modules to nginx image?
Practice of Xiaoxiong school development board: real equipment access of smart street lamp sandbox experiment
Erd-online free online database modeling tool