- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我是 Docker 和容器的新手。我正在阅读 docker 的教程并遇到了这些信息。 https://docs.docker.com/get-started/part3/#docker-composeyml
networks:
- webnet
networks:
webnet:
什么是网络?文件说
Instruct web’s containers to share port 80 via a load-balanced network called webnet. (Internally, the containers themselves will publish to web’s port 80 at an ephemeral port.)
那么,默认情况下,覆盖网络在 docker 集群中是负载均衡的?使用什么负载平衡算法?
实际上,我不清楚为什么我们要在覆盖网络上进行负载平衡。
最佳答案
不确定我是否比文档更清楚,但也许改写会有所帮助。
首先,您在此处关注的文档使用了所谓的 swarm mode
docker 。
什么是swarm mode
?
A swarm is a cluster of Docker engines, or nodes, where you deploy services. The Docker Engine CLI and API include commands to manage swarm nodes (e.g., add or remove nodes), and deploy and orchestrate services across the swarm.
来自 SO 文档:
A swarm is a number of Docker Engines (or nodes) that deploy services collectively. Swarm is used to distribute processing across many physical, virtual or cloud machines.
因此,在集群模式下,您拥有一个多主机(虚拟机和/或物理)集群,这些机器通过它们的 docker engine
相互通信。 .
第一季度。什么是网络?
webnet
是 overlay network 的名称它是在您的堆栈启动时创建的。
Overlay networks manage communications among the Docker daemons participating in the swarm
在您的机器集群中,创建了一个虚拟网络,其中每个服务都有一个 ip - 映射到一个内部 DNS 条目(即服务名称),并允许 docker 将传入的数据包路由到正确的容器,无处不在群(集群)。
第二季度。那么,默认情况下,覆盖网络在 docker 集群中是负载均衡的?
是的,如果您使用覆盖网络,但您也可以删除服务 networks
配置以绕过它。那么你将不得不 publish您要公开的服务的端口。
第三季度。使用了什么负载均衡算法?
从此SO question由群主回答 bmitch ;):
The algorithm is currently round-robin and I've seen no indication that it's pluginable yet. A higher level load balancer would allow swarm nodes to be taken down for maintenance, but any sticky sessions or other routing features will be undone by the round-robin algorithm in swarm mode.
第四季度。实际上我不清楚为什么我们要在覆盖网络上进行负载平衡
docker swarm 模式/服务的目的是允许编排复制的服务,这意味着我们可以扩大/缩小部署在 swarm 中的容器。
来自 docs再次:
Swarm mode has an internal DNS component that automatically assigns each service in the swarm a DNS entry. The swarm manager uses internal load balancing to distribute requests among services within the cluster based upon the DNS name of the service.
因此,您可以部署 10 个完全相同的容器(假设 nginx 与您的应用程序 html/js),而无需处理私有(private)网络 DNS 条目、端口配置等...任何传入请求都将自动负载平衡到主机参与群。
希望这会有所帮助!
关于networking - 网络和负载均衡器如何在 docker swarm 模式下工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44647924/
我正在使用AWS中的VM设置Elasticsearch集群。 我知道每个节点都会自动尝试加入一个在同一网络中具有相同群集名称的现有群集。 但是,我无法理解“同一网络” 是什么。 为了了解同一网络,我发
我尝试部署一个已经存在于 Kovan 网络上的合约实例,以通过 web3 和 metamask 与其交互。 首先,我将 metamask 设置为我的当前提供者,然后我部署了一个合约实例,如下所示:
停止 docker 后,它拒绝重新启动。它提示另一个名为 docker0 的网桥已经存在: level=warning msg="devmapper: Base device already exis
我正在使用“docker network create --d bridge mynet”创建一个 docker 网络。我想获取与此 docker 网络关联的网桥名称。 我知道我可以使用“-o”来提供
我的一位同事的VPN连接有问题。似乎他的操作系统重设了代理设置,并且他需要手动将其更改回。有没有办法使用Powershell设置VPN和代理? 他正在使用Windows 7,因此可以使用Powersh
我在 Azure VM 中有一个虚拟机,我想获取网络输入/网络输出指标。 在 Azure 门户中,我将诊断设置和指标设置为存储到选定的存储表中。但存储的指标与我在 Azure 门户中看到的指标之间存在
我有一个用例,我的 Docker 容器的第二个接口(interface)需要共享主机的第二个网络接口(interface)的接口(interface)。这可能使用 docker network con
我在 Azure VM 中有一个虚拟机,我想获取网络输入/网络输出指标。 在 Azure 门户中,我将诊断设置和指标设置为存储到选定的存储表中。但存储的指标与我在 Azure 门户中看到的指标之间存在
我想了解一些关于 Docker 的事情: 如何找到我的容器所在的网络? 我可以动态分离我的容器并附加到其他网络吗?怎么样? 如果我有两个容器正在运行,如何检查这两个容器是否在同一个网络?我可以 pin
我已经开发了一款使用Reaction Native和世博会的应用程序,并想在它的末尾添加一个横幅广告。当我在Android模拟器上的开发版本上运行应用程序时,应用程序的其余部分在没有应用程序的情况下运
我已经编辑了 eth0,但我犯了一个错误,我的 VPS 现在处于脱机状态,甚至无法连接到 ssh,并在故障恢复控制台显示以下消息: “网络不可达”。 配置/编辑网络的命令是什么!? Photo 最佳答
今天早上我启动了我的 GCE 实例,并且 4/6 完全无法访问。所有这些都在同一个 us-east1-d 区域中。 SSH 连接也无法正常工作,因此我使用串行控制台连接到有问题的实例之一。 当我尝试
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 想改进这个问题?将问题更新为 on-topic对于堆栈溢出。 5年前关闭。 Improve this qu
我正在使用 Network.Browser 4000.0.9 检索网页: import Network.Browser import Network.HTTP main = do (uri
我正在尝试更新我在 docker 容器中的 apt 存储库,但我做不到。 docker run -it --dns 8.8.8.8 --dns 8.8.4.4 debian apt-get 更新 ..
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
Axios 是否可以区分以下内容: 由于客户端没有网络连接而失败的请求发出请求的时间 - (ERR_CONNECTION_REFUSED)。 由于网络连接丢失而失败的请求之后已发出请求,但在收到响应之
Unity 已升级其网络系统,并将旧网络称为遗留网络。 那么我们如何将 RPC 调用更改为新的 Unity Networking?这种方法的等价物是什么?我们应该为它编写自己的方法吗? (发送字节数组
在机器学习工具 vowpal wabbit ( https://github.com/JohnLangford/vowpal_wabbit/ ) 中,通常训练线性估计器 y*=wx。但是,可以添加前向
我正在尝试将 Boost 用于某些 IPv6 和多播网络通信。我需要构建一个使用特定网络接口(interface)索引的 IPv6 多播套接字。 我能够在 boost/asio/ip/detail/s
我是一名优秀的程序员,十分优秀!