当前位置:网站首页>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
边栏推荐
- Git remote library rollback specified version
- Zhou Jie: database system of East China Normal University
- How to optimize the decoding performance of dynamsoft barcode reader
- 南京标识标牌设计制作,导视VI系统设计
- Ora-02292: complete constraint violation (midbjdev2.sys_ C0020757) - subrecord found
- Jenkins入门(二)声明式流水线Jenkins Pipeline
- RFID fixed assets management system for fire equipment
- 2020-08-15: under what circumstances should data tasks be optimized?
- Image processing toolkit imagexpresshow to view events
- 如何才能快速正确的部署甘特图
猜你喜欢
QT audio and video development 46 video transmission UDP version
Three steps to understand Kerberos Protocol easily
Common syntax corresponding table of mongodb and SQL
ado.net and asp.net The relationship between
测试攻城狮必备技能点!一文带你解读DevOps下的测试技术
The advantages and functions of psychological counseling app
Nonvolatile MRAM memory used in all levels of cache
心理咨询app开发所具备的优点与功能
In 2020, how can wechat seal numbers be quickly lifted?
7. Swarm builds clusters
随机推荐
August 18, 2020: introduce Mr process?
频收罚单的浦发银行:增收不增利,曾遭骗贷数亿元,内控缺位?
How to deploy Gantt chart quickly and correctly
Nodejs中使用jsonwebtoken(JWT)生成token的场景使用
条形码识别性能低,如何优化Dynamsoft Barcode Reader解码性能
How does varhart xgantt represent working days on a calendar
Test the necessary skill points of siege lion! This article takes you to interpret the testing technology under Devops
k-vim安装及The ycmd server SHUT DOWN (restart with ':YcmRestartServer')这种错误的解决方法
甘特图对活动进行分组教程
[graffiti Internet of things footprints] panoramic introduction of graffiti cloud platform
PHP后门隐藏技巧
Configuration of AP hotspot on xunwei-imx6ull development board
FreeSWITCH视频会议“标准”解决方案
Python 3 operates the Jenkins module API
The advantages and functions of psychological counseling app
8. Swarm creates maintenance and horizontal extension service
August 24, 2020: what are small documents? What's wrong with a lot of small files? How to solve many small files? (big data)
idea 激活到 2089 失效
如何创建交互式内核密度图表
Bluetooth broadcast chip for Shanghai giant micro